- 晚上定时同步时强制同步价格与可售状态

This commit is contained in:
gazebo
2019-08-09 18:35:29 +08:00
parent 64a4ceda62
commit 28124c18d4
2 changed files with 14 additions and 6 deletions

View File

@@ -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 // 绿城四季鲜店

View File

@@ -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)
}