diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index f12d6da86..3c85c2913 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -517,9 +517,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo var failedList []*partner.StoreSkuInfoWithErr failedList, err = storeSkuHandler.UpdateStoreSkusStock(ctx, storeID, vendorStoreID, batchedStoreSkuList) if len(failedList) > 0 { - for _, v := range failedList { - fmt.Println(v.StoreSkuInfo, v.ErrMsg) - } task.AddErrMsg(failedList) } successList := putils.UnselectStoreSkuListByVendorSkuIDs(batchedStoreSkuList, GetVendorSkuIDList(failedList)) diff --git a/business/jxutils/tasksch/task.go b/business/jxutils/tasksch/task.go index b218f9855..a221a7787 100644 --- a/business/jxutils/tasksch/task.go +++ b/business/jxutils/tasksch/task.go @@ -66,6 +66,7 @@ type ITask interface { AddErrMsg(failedList ...interface{}) GetErrMsg() (failedList []interface{}) SetFinishHook(func(task ITask)) + GetFinishHook() func(task ITask) json.Marshaler } @@ -229,6 +230,10 @@ func (t *BaseTask) GetTotalJobCount() int { return t.TotalJobCount } +func (t *BaseTask) GetFinishHook() func(ITask) { + return t.FinishHook +} + func (t *BaseTask) GetFinishedJobCount() int { t.locker.RLock() defer t.locker.RUnlock() @@ -474,7 +479,7 @@ func (t *BaseTask) run(taskHandler func()) { ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "异步任务完成", content) } } - t.SetFinishHook(t.FinishHook) + t.GetFinishHook() }) } } diff --git a/business/partner/partner_store_sku.go b/business/partner/partner_store_sku.go index f66a9f233..9ed7ff3be 100644 --- a/business/partner/partner_store_sku.go +++ b/business/partner/partner_store_sku.go @@ -144,7 +144,7 @@ type ISingleStoreStoreSkuHandler interface { GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (outSkuNameList []*SkuNameInfo, err error) CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (successList []*dao.StoreSkuSyncInfo, err error) - UpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*dao.StoreSkuSyncInfo, err error) + UpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*dao.StoreSkuInfoWithErr, err error) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (successList []*StoreSkuInfo, err error) DeleteStoreAllSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, isContinueWhenError bool) (err error) IsErrSkuExist(err error) (isExist bool) diff --git a/business/partner/putils/store_sku.go b/business/partner/putils/store_sku.go index e688c5e7a..c17608497 100644 --- a/business/partner/putils/store_sku.go +++ b/business/partner/putils/store_sku.go @@ -297,16 +297,16 @@ func SelectStoreSkuListByResponseList(storeSkuList []*partner.StoreSkuInfo, resp } func GetErrMsg2FailedSingleList(storeSkuList []*partner.StoreSkuInfo, err error) (failedList []*partner.StoreSkuInfoWithErr) { - failedList2 := make([]*partner.StoreSkuInfoWithErr, 1) if err != nil { if errExt, ok := err.(*utils.ErrorWithCode); ok { - failedList2[0] = &partner.StoreSkuInfoWithErr{ + storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{ StoreSkuInfo: storeSkuList[0], ErrMsg: errExt.ErrMsg(), } + failedList = append(failedList, storeSkuInfoWithErr) } } - return failedList2 + return failedList } func UnselectStoreSkuSyncListByVendorSkuIDs(storeSkuList []*dao.StoreSkuSyncInfo, vendorSkuIDs []string) (selectedStoreSkuList []*dao.StoreSkuSyncInfo) {