This commit is contained in:
engigu
2024-01-03 22:08:45 +08:00
parent 0193e6da3c
commit 2730bb97ca
4 changed files with 5 additions and 6 deletions
+1
View File
@@ -19,6 +19,7 @@ require (
)
require (
github.com/blinkbean/dingtalk v0.0.0-20230927120905-796332ac4ba1 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
+2
View File
@@ -1,3 +1,5 @@
github.com/blinkbean/dingtalk v0.0.0-20230927120905-796332ac4ba1 h1:G14RkaB3RRW099aQbfyHm4RFgNxGUOTeHSoN+CZy2YI=
github.com/blinkbean/dingtalk v0.0.0-20230927120905-796332ac4ba1/go.mod h1:9BaLuGSBqY3vT5hstValh48DbsKO7vaHaJnG9pXwbto=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
-4
View File
@@ -21,13 +21,11 @@ func ClearLogs() {
sm := send_message_service.SendMessageService{TaskID: constant.CleanLogsTaskId}
sm.Status = send_message_service.SendSuccess
logging.Logger.Error("开始清除日志")
sm.LogsAndStatusMark("开始清除日志", sm.Status)
setting, err := models.GetSettingByKey(constant.LogsCleanSectionName, constant.LogsCleanKeepKeyName)
if err != nil {
errStr = fmt.Sprintf("获取日志的保留数失败,原因:%s", err)
logging.Logger.Error(errStr)
sm.LogsAndStatusMark(errStr, send_message_service.SendFail)
}
@@ -35,11 +33,9 @@ func ClearLogs() {
affectedRows, err := models.DeleteOutDateLogs(keepNum)
if err != nil {
errStr = fmt.Sprintf("删除日志失败,原因:%s", err)
logging.Logger.Error(errStr)
sm.LogsAndStatusMark(errStr, send_message_service.SendFail)
} else {
errStr = fmt.Sprintf("删除日志成功,删除条数:%d,保留数目:%d", affectedRows, keepNum)
logging.Logger.Error(errStr)
sm.LogsAndStatusMark(errStr, sm.Status)
}
+2 -2
View File
@@ -37,7 +37,7 @@ func (sm *SendMessageService) LogsAndStatusMark(errStr string, status int) {
if status == SendFail {
sm.Status = SendFail
}
logging.Logger.Info(fmt.Sprintf("%s, 状态:%d", errStr, status))
logging.Logger.Error(fmt.Sprintf("%s, 状态:%d", errStr, status))
}
// Send 发送一个消息任务的所有实例
@@ -112,7 +112,7 @@ func (sm *SendMessageService) Send() string {
return strings.Join(sm.LogOutput, "\n")
}
// FormatSendContent 格式化输出的发送内容
// AppendSendContent 添加发送内容
func (sm *SendMessageService) AppendSendContent() {
sm.LogOutput = append(sm.LogOutput, fmt.Sprintf(">> 发送的内容:"))
if sm.Text != "" {