重构部分枚举, 让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

@@ -9,6 +9,8 @@ import (
"strings"
"sync"
"time"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
)
const (
@@ -55,7 +57,7 @@ func (w *wechatNotifier) Send(ctx context.Context, content AlarmContent, toAddr
// 2. 构建 markdown 内容
markdownContent := fmt.Sprintf("## %s\n> 级别: <font color=\"warning\">%s</font>\n> 时间: %s\n\n%s",
content.Title,
content.Level.String(),
content.Level,
content.Timestamp.Format(DefaultTimeFormat),
content.Message,
)
@@ -142,8 +144,8 @@ func (w *wechatNotifier) getAccessToken() (string, error) {
}
// Type 返回通知器的类型
func (w *wechatNotifier) Type() NotifierType {
return NotifierTypeWeChat
func (w *wechatNotifier) Type() models.NotifierType {
return models.NotifierTypeWeChat
}
// --- API 数据结构 ---