- add param isContinueWhenError for SyncStoresSkus.
This commit is contained in:
@@ -240,7 +240,7 @@ func UpdateStoreSkus(ctx *jxcontext.Context, storeID int, skuBindInfos []*StoreS
|
||||
skuIDs, err := updateStoreSkusWithoutSync(ctx, storeID, skuBindInfos, userName)
|
||||
if err == nil {
|
||||
db := dao.GetDB()
|
||||
_, err = CurVendorSync.SyncStoresSkus(ctx, db, nil, []int{storeID}, skuIDs, false, userName)
|
||||
_, err = CurVendorSync.SyncStoresSkus(ctx, db, nil, []int{storeID}, skuIDs, false, false)
|
||||
return int64(len(skuIDs)), err
|
||||
}
|
||||
return 0, err
|
||||
@@ -389,7 +389,7 @@ func UpdateStoresSkus(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*St
|
||||
}
|
||||
}
|
||||
db := dao.GetDB()
|
||||
_, err = CurVendorSync.SyncStoresSkus(ctx, db, nil, storeIDs, skuIDs, false, userName)
|
||||
_, err = CurVendorSync.SyncStoresSkus(ctx, db, nil, storeIDs, skuIDs, false, false)
|
||||
return num, err
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ func UpdateStoresSkusSale(ctx *jxcontext.Context, storeIDs []int, skuBindSkuInfo
|
||||
skuIDs = append(skuIDs, v.SkuID)
|
||||
}
|
||||
db := dao.GetDB()
|
||||
_, err = CurVendorSync.SyncStoresSkus(ctx, db, nil, storeIDs, skuIDs, false, userName)
|
||||
_, err = CurVendorSync.SyncStoresSkus(ctx, db, nil, storeIDs, skuIDs, false, false)
|
||||
return num, err
|
||||
}
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v
|
||||
}
|
||||
|
||||
//
|
||||
func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs []int, storeIDs []int, skuIDs []int, isAsync bool, userName string) (hint string, err error) {
|
||||
func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs []int, storeIDs []int, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debug("SyncStoresSkus")
|
||||
return v.LoopStoresMap(ctx, db, "SyncStoresSkus", isAsync, vendorIDs, storeIDs, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo)
|
||||
@@ -303,14 +303,14 @@ func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendo
|
||||
if len(loopMapInfo.StoreMapList) > 1 {
|
||||
loopStoreTask := tasksch.NewSeqTask("SyncStoresSkus loop stores", ctx.GetUserName(), func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
storeID := loopMapInfo.StoreMapList[step].StoreID
|
||||
_, err = handler.SyncStoreSkus(ctx, task, storeID, skuIDs, false)
|
||||
_, err = handler.SyncStoreSkus(ctx, task, storeID, skuIDs, false, isContinueWhenError)
|
||||
return nil, err
|
||||
}, len(loopMapInfo.StoreMapList))
|
||||
t.AddChild(loopStoreTask).Run()
|
||||
_, err = loopStoreTask.GetResult(0)
|
||||
return nil, err
|
||||
}
|
||||
_, err = handler.SyncStoreSkus(ctx, t, loopMapInfo.StoreMapList[0].StoreID, skuIDs, false)
|
||||
_, err = handler.SyncStoreSkus(ctx, t, loopMapInfo.StoreMapList[0].StoreID, skuIDs, false, isContinueWhenError)
|
||||
}
|
||||
return nil, err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user