准备切换thing_map,IsUseThingMap

This commit is contained in:
gazebo
2019-12-10 09:43:08 +08:00
parent 46d3d7d8f0
commit 87e8aec310
3 changed files with 204 additions and 2 deletions

View File

@@ -129,6 +129,13 @@ func (v *VendorSync) syncCategories(ctx *jxcontext.Context, parentTask tasksch.I
}
func (v *VendorSync) SyncCategory(ctx *jxcontext.Context, db *dao.DaoDB, categoryID int, isAsync bool, userName string) (hint string, err error) {
if !model.IsUseThingMap {
return v.oldSyncCategory(ctx, db, categoryID, isAsync, userName)
}
return SyncCategories(ctx, nil, nil, nil, []int{categoryID}, isAsync)
}
func (v *VendorSync) oldSyncCategory(ctx *jxcontext.Context, db *dao.DaoDB, categoryID int, isAsync bool, userName string) (hint string, err error) {
globals.SugarLogger.Debug("SyncCategory")
hint, err = v.LoopMultiStoresVendors(ctx, db, fmt.Sprintf("同步分类信息:%d", categoryID), isAsync, false,
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
@@ -158,6 +165,13 @@ func (v *VendorSync) SyncCategory(ctx *jxcontext.Context, db *dao.DaoDB, categor
}
func (v *VendorSync) SyncReorderCategories(ctx *jxcontext.Context, db *dao.DaoDB, categoryID int, isAsync bool, userName string) (hint string, err error) {
if !model.IsUseThingMap {
return v.oldSyncReorderCategories(ctx, db, categoryID, isAsync, userName)
}
return SyncReorderCategories(ctx, -1, isAsync)
}
func (v *VendorSync) oldSyncReorderCategories(ctx *jxcontext.Context, db *dao.DaoDB, categoryID int, isAsync bool, userName string) (hint string, err error) {
hint, err = v.LoopMultiStoresVendors(ctx, db, fmt.Sprintf("分类重排序:%d", categoryID), isAsync, false, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
vendorInfo := batchItemList[0].(*tMultiStoreVendorInfo)
multiStoresHandler := v.GetMultiStoreHandler(vendorInfo.VendorID)
@@ -232,6 +246,13 @@ func (v *VendorSync) SyncSku(ctx *jxcontext.Context, db *dao.DaoDB, nameID, skuI
}
func (v *VendorSync) SyncSkus(ctx *jxcontext.Context, db *dao.DaoDB, nameIDs []int, skuIDs []int, isAsync, isContinueWhenError bool, userName string) (hint string, err error) {
if !model.IsUseThingMap {
return v.oldSyncSkus(ctx, db, nameIDs, skuIDs, isAsync, isContinueWhenError, userName)
}
return SyncSkus(ctx, nil, nil, nil, nameIDs, skuIDs, isAsync)
}
func (v *VendorSync) oldSyncSkus(ctx *jxcontext.Context, db *dao.DaoDB, nameIDs []int, skuIDs []int, isAsync, isContinueWhenError bool, userName string) (hint string, err error) {
globals.SugarLogger.Debugf("SyncSku trackInfo:%s, nameIDs:%v, skuIDs:%v, userName:%s", ctx.GetTrackInfo(), nameIDs, skuIDs, userName)
isManagedIt := !(len(nameIDs) > 0 && len(nameIDs) <= 2 || len(skuIDs) > 0 && len(skuIDs) < 8)
return v.LoopMultiStoresVendors(ctx, db, fmt.Sprintf("同步商品信息, nameIDs:%v, skuIDs:%v", nameIDs, skuIDs), isAsync, isManagedIt,