From 28124c18d48a2572f51be57d58284e484b476c6d Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 9 Aug 2019 18:35:29 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=99=9A=E4=B8=8A=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=97=B6=E5=BC=BA=E5=88=B6=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E4=B8=8E=E5=8F=AF=E5=94=AE=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 18 +++++++++++++----- business/jxstore/misc/misc.go | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index a13d17676..8a036a363 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -392,15 +392,15 @@ 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, isForce, isAsync, isContinueWhenError bool) (hint string, err error) { - globals.SugarLogger.Debug("SyncStoresSkus") +func (v *VendorSync) SyncStoresSkus2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs []int, storeIDs []int, skuIDs []int, setSyncStatus int, isAsync, isContinueWhenError bool) (hint string, err error) { + globals.SugarLogger.Debug("SyncStoresSkus2") isManageIt := isAsync || len(storeIDs) != 1 || len(skuIDs) == 0 || len(skuIDs) > 8 task, hint, err := v.LoopStoresMap2(ctx, db, fmt.Sprintf("同步门店商品信息:%v", storeIDs), isAsync, isManageIt, vendorIDs, storeIDs, func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) { loopMapInfo := batchItemList[0].(*LoopStoreMapInfo) if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil { - if isForce { - dao.SetStoreSkuSyncStatus(db, loopMapInfo.VendorID, storeIDs, skuIDs, model.SyncFlagStoreSkuModifiedMask) + if setSyncStatus != 0 { + dao.SetStoreSkuSyncStatus(db, loopMapInfo.VendorID, storeIDs, skuIDs, setSyncStatus) } parallelCount := 5 if model.MultiStoresVendorMap[loopMapInfo.VendorID] == 1 { @@ -411,7 +411,7 @@ func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendo func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { storeMap := batchItemList[0].(*model.StoreMap) if _, err = v.proxySyncStoreSku(ctx, task, storeMap, nil, skuIDs, false, isContinueWhenError); err != nil { - globals.SugarLogger.Debugf("SyncStoresSkus failed2 store:%d failed with error:%v", storeMap.StoreID, err) + globals.SugarLogger.Debugf("SyncStoresSkus2 failed2 store:%d failed with error:%v", storeMap.StoreID, err) } return nil, err }, loopMapInfo.StoreMapList) @@ -438,6 +438,14 @@ func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendo return hint, err } +func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs []int, storeIDs []int, skuIDs []int, isForce, isAsync, isContinueWhenError bool) (hint string, err error) { + setSyncStatus := 0 + if isForce { + setSyncStatus = model.SyncFlagStoreSkuModifiedMask + } + return v.SyncStoresSkus2(ctx, db, vendorIDs, storeIDs, skuIDs, setSyncStatus, isAsync, isContinueWhenError) +} + func isUseOldSyncLogic(storeMap *model.StoreMap) bool { return false return globals.IsProductEnv() && storeMap.StoreID != 102652 // 绿城四季鲜店 diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index bf371f104..ff108085c 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -115,7 +115,7 @@ func doDailyWork() { // cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD}, nil, true, true) SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID) - taskID, _ := cms.CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, false, true, true) + taskID, _ := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, model.SyncFlagSaleMask|model.SyncFlagPriceMask, true, true) SaveImportantTaskID(TaskNameSyncStoreSku, taskID) }