diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index bbd964ee1..bc61c93fa 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -50,6 +50,10 @@ type SyncError struct { Message string `json:"message"` } +type SpecSyncError struct { + SpecErr error `json:"specErr"` +} + // 对于多门店平台接口的通用处理 type MultiStoreHandlerWrapper struct { partner.IMultipleStoresHandler @@ -633,8 +637,8 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, db *dao.DaoDB, taskN if len(task.GetFailedList()) > 10 { downloadURL, _, _ := WirteToExcelBySyncFailed(task) noticeMsg = fmt.Sprintf("[详情点我]path1=%s\n", downloadURL) - } else { - if err != nil { + } else if len(task.GetFailedList()) > 0 && len(task.GetFailedList()) <= 10 { + if task.GetErr() != nil { noticeMsg = utils.Format4Output(buildErrMsgJson(task), true) } } @@ -664,7 +668,7 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, db *dao.DaoDB, taskN func buildErrMsg(task tasksch.ITask) (err error) { err = fmt.Errorf(utils.Format4Output(buildErrMsgJson(task), true)) - return makeSyncError(err) + return makeSpecSyncError(err) } func buildErrMsgJson(task tasksch.ITask) (resultL []*SyncErrResult) { @@ -760,6 +764,21 @@ func makeSyncError(err error) (newErr error) { return err } +func makeSpecSyncError(err error) (newErr error) { + if err != nil { + if _, ok := err.(*SpecSyncError); !ok { + return &SpecSyncError{ + SpecErr: err, + } + } + } + return err +} + +func (e *SpecSyncError) Error() string { + return e.SpecErr.Error() +} + func (e *SyncError) Error() string { return fmt.Sprintf("本地数据修改成功,但同步失败,请根据错误提示处理!,同步错误信息:%s", e.Original.Error()) }