完成钉钉机器人消息通知

This commit is contained in:
marvzhang
2020-01-15 13:04:59 +08:00
parent eab6b39603
commit ee0e231ad4
2 changed files with 21 additions and 27 deletions

View File

@@ -813,11 +813,11 @@ func SendTaskEmail(u model.User, t model.Task, s model.Spider) {
}
func SendTaskDingTalk(u model.User, t model.Task, s model.Spider) {
statusMsg := "has finished"
statusMsg := "已完成"
if t.Status == constants.StatusError {
statusMsg = "has an error"
statusMsg = "发生错误"
}
title := fmt.Sprintf("[Crawlab] Task for \"%s\" %s", s.Name, statusMsg)
title := fmt.Sprintf("[Crawlab] \"%s\" 任务%s", s.Name, statusMsg)
content := GetTaskDingTalkMarkdownContent(t, s)
if err := notification.SendDingTalkNotification(u.Setting.DingTalkRobotWebhook, title, content); err != nil {
log.Errorf(err.Error())