This commit is contained in:
邹宗楠
2022-10-08 20:18:41 +08:00
parent 5b8e769ed1
commit 22649b2eb2

View File

@@ -490,10 +490,12 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v
func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) { func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag int, db *dao.DaoDB, vendorIDs []int, storeIDs []int, syncDisabled bool, skuIDs, excludeSkuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) {
globals.SugarLogger.Debug("SyncStoresSkus2") globals.SugarLogger.Debug("SyncStoresSkus2")
isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8 isManageIt := len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8
task, hint, err := v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false,
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { funcParam := func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
globals.SugarLogger.Debug("SyncStoresSkus2===============0")
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) loopMapInfo := batchItemList[0].(*LoopStoreMapInfo)
if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil {
globals.SugarLogger.Debug("SyncStoresSkus2===============1")
parallelCount := 5 parallelCount := 5
if model.MultiStoresVendorMap[loopMapInfo.VendorID] == 1 { if model.MultiStoresVendorMap[loopMapInfo.VendorID] == 1 {
parallelCount = 2 parallelCount = 2
@@ -502,9 +504,9 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.
tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetIsContinueWhenError(isContinueWhenError), ctx, tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
storeMap := batchItemList[0].(*model.StoreMap) storeMap := batchItemList[0].(*model.StoreMap)
globals.SugarLogger.Debug("SyncStoresSkus2===============1")
if syncDisabled || storeMap.Status > model.StoreStatusDisabled {
globals.SugarLogger.Debug("SyncStoresSkus2===============2") globals.SugarLogger.Debug("SyncStoresSkus2===============2")
if syncDisabled || storeMap.Status > model.StoreStatusDisabled {
globals.SugarLogger.Debug("SyncStoresSkus2===============3")
if setSyncStatus != 0 { if setSyncStatus != 0 {
dao.SetStoreSkuSyncStatus(db, storeMap.VendorID, []int{storeMap.StoreID}, skuIDs, setSyncStatus) dao.SetStoreSkuSyncStatus(db, storeMap.VendorID, []int{storeMap.StoreID}, skuIDs, setSyncStatus)
} }
@@ -518,7 +520,9 @@ func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, parentTask tasksch.
_, err = loopStoreTask.GetResult(0) _, err = loopStoreTask.GetResult(0)
} }
return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID) return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
}, isContinueWhenError) }
task, hint, err := v.LoopStoresMap2(ctx, parentTask, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, false, funcParam, isContinueWhenError)
if task != nil { if task != nil {
err = makeSyncError(err) err = makeSyncError(err)
} }