From 34ae5e2ce691805c3e771e7b9bcf4d0e0df57bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 4 Feb 2020 13:47:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 215e72811..6cdfb6115 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -651,12 +651,13 @@ func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) { if len(task.GetFailedList()) > 10 { downloadURL, _, _ := WirteToExcelBySyncFailed(task) noticeMsg += fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL) + if authInfo, err := ctx.GetV2AuthInfo(); err == nil { + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg) + } } else if len(task.GetFailedList()) > 0 && len(task.GetFailedList()) <= 10 { if task.GetErr() != nil { noticeMsg += utils.Format4Output(buildErrMsgJson(task), true) } - } - if len(task.GetFailedList()) != 0 { if authInfo, err := ctx.GetV2AuthInfo(); err == nil { ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg) } From 924d25d765457a74f730bb962ab92b3abf58c685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 4 Feb 2020 14:09:16 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E3=80=82=E6=97=A0=E9=94=99=E8=AF=AF=E8=A6=81?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=80=E4=B8=AA=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/tasksch/task.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxutils/tasksch/task.go b/business/jxutils/tasksch/task.go index 89f407e4a..a9735d88e 100644 --- a/business/jxutils/tasksch/task.go +++ b/business/jxutils/tasksch/task.go @@ -475,6 +475,7 @@ func (t *BaseTask) run(taskHandler func()) { close(t.finishChan) if t.finishHook != nil { t.finishHook(t) + SendMessage(t) } else { SendMessage(t) } From c583f910aa98c3438430b3d04681e3b11f992e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 4 Feb 2020 14:30:17 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 11 +++++------ business/jxutils/tasksch/task.go | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 6cdfb6115..4d4b3087f 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -651,16 +651,15 @@ func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) { if len(task.GetFailedList()) > 10 { downloadURL, _, _ := WirteToExcelBySyncFailed(task) noticeMsg += fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL) - if authInfo, err := ctx.GetV2AuthInfo(); err == nil { - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg) - } } else if len(task.GetFailedList()) > 0 && len(task.GetFailedList()) <= 10 { if task.GetErr() != nil { noticeMsg += utils.Format4Output(buildErrMsgJson(task), true) } - if authInfo, err := ctx.GetV2AuthInfo(); err == nil { - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg) - } + } else { + noticeMsg = "您的同步任务执行完成,没有错误返回。" + } + if authInfo, err := ctx.GetV2AuthInfo(); err == nil { + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg) } } else { if time.Now().Hour() >= 20 || time.Now().Hour() < 7 { diff --git a/business/jxutils/tasksch/task.go b/business/jxutils/tasksch/task.go index a9735d88e..89f407e4a 100644 --- a/business/jxutils/tasksch/task.go +++ b/business/jxutils/tasksch/task.go @@ -475,7 +475,6 @@ func (t *BaseTask) run(taskHandler func()) { close(t.finishChan) if t.finishHook != nil { t.finishHook(t) - SendMessage(t) } else { SendMessage(t) } From 24506a22f9ca92297b1dc0e2744bdf8b5925a427 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 4 Feb 2020 14:20:04 +0800 Subject: [PATCH 4/5] SyncQualify --- business/partner/purchase/jd/store.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/jd/store.go b/business/partner/purchase/jd/store.go index 4a9b73857..549a3553a 100644 --- a/business/partner/purchase/jd/store.go +++ b/business/partner/purchase/jd/store.go @@ -403,15 +403,15 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S var qualifyList []*jdapi.QualifyItem licenceDetail, err := api.JdPageAPI.GetCorporationInfo(storeDetail.VendorStoreID, storeDetail.LicenceCode) if err != nil { - return err + return addStoreInfo2Err(err, storeDetail.ID) } licenceURL, err := c.storeUploadImgByURL(storeDetail.VendorOrgCode, storeDetail.Licence) if err != nil { - return err + return addStoreInfo2Err(err, storeDetail.ID) } expireStart, err := utils.TryStr2Time(licenceDetail.StartDate) if err != nil { - return fmt.Errorf("执照有效开始时间:%s非法,请手动处理", licenceDetail.StartDate) + return addStoreInfo2Err(fmt.Errorf("执照有效开始时间:%s非法,请手动处理", licenceDetail.StartDate), storeDetail.ID) } qualifyList = append(qualifyList, &jdapi.QualifyItem{ QualifyType: jdapi.QualifyTypeCompany, From 5074a053cdb5bf25be7db171f16f06e219e23f8c Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 4 Feb 2020 14:26:13 +0800 Subject: [PATCH 5/5] up --- business/partner/purchase/jd/store.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/jd/store.go b/business/partner/purchase/jd/store.go index 549a3553a..997540924 100644 --- a/business/partner/purchase/jd/store.go +++ b/business/partner/purchase/jd/store.go @@ -386,7 +386,10 @@ func (c *PurchaseHandler) storeUploadImgByURL(vendorOrgCode, inImgURL string) (i func addStoreInfo2Err(err error, storeID int) error { if err != nil { - errExt := utils.NewErrorCode(err.Error(), "999") + errExt, _ := err.(*utils.ErrorWithCode) + if errExt == nil { + errExt = utils.NewErrorCode(err.Error(), "999") + } errExt.AddPrefixMsg(fmt.Sprintf("门店%d", storeID)) err = errExt }