重构部分枚举, 让models包不依赖其他项目中的包

This commit is contained in:
2025-11-07 21:39:24 +08:00
parent 375af57afe
commit 2796d9bad7
17 changed files with 188 additions and 148 deletions

View File

@@ -5,6 +5,8 @@ import (
"fmt"
"net/smtp"
"strings"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
)
// smtpNotifier 实现了 Notifier 接口,用于通过 SMTP 发送邮件通知。
@@ -45,7 +47,7 @@ func (s *smtpNotifier) Send(ctx context.Context, content AlarmContent, toAddr st
// 邮件正文
body := fmt.Sprintf("级别: %s\n时间: %s\n\n%s",
content.Level.String(),
content.Level,
content.Timestamp.Format(DefaultTimeFormat),
content.Message,
)
@@ -71,6 +73,6 @@ func (s *smtpNotifier) Send(ctx context.Context, content AlarmContent, toAddr st
}
// Type 返回通知器的类型
func (s *smtpNotifier) Type() NotifierType {
return NotifierTypeSMTP
func (s *smtpNotifier) Type() models.NotifierType {
return models.NotifierTypeSMTP
}