Accept Merge Request #174: (su -> mark)

Merge Request: 同步错误返回修改
Created By: @苏尹岚
Accepted By: @苏尹岚
URL: https://rosydev.coding.net/p/jx-callback/d/jx-callback/git/merge/174
This commit is contained in:
苏尹岚
2020-02-04 13:43:11 +08:00

View File

@@ -646,9 +646,6 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I
func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) {
task.SetFinishHook(func(task tasksch.ITask) {
if len(task.GetFailedList()) == 0 {
return
}
var noticeMsg = "您此次的同步任务错误详情返回如下: \n"
if ctx.GetUserName() != "jxadmin" {
if len(task.GetFailedList()) > 10 {
@@ -659,11 +656,13 @@ func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) {
noticeMsg += utils.Format4Output(buildErrMsgJson(task), true)
}
}
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg)
if len(task.GetFailedList()) != 0 {
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg)
}
}
} else {
if time.Now().Hour() >= 20 && time.Now().Hour() < 7 {
if time.Now().Hour() >= 20 || time.Now().Hour() < 7 {
downloadURL, _, _ := WirteToExcelBySyncFailed(task)
user, err := dao.GetUserByID(dao.GetDB(), "mobile", "18160030913")
noticeMsg += fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL)