- 修复之前将老平台同步逻辑注释掉引入的BUG
This commit is contained in:
@@ -380,14 +380,13 @@ func (v *VendorSync) SyncStoresCategory(ctx *jxcontext.Context, db *dao.DaoDB, v
|
||||
if len(loopMapInfo.StoreMapList) > 1 {
|
||||
loopStoreTask := tasksch.NewSeqTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), ctx,
|
||||
func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
storeID := loopMapInfo.StoreMapList[step].StoreID
|
||||
_, err = handler.SyncStoreCategory(ctx, task, storeID, false)
|
||||
_, err = v.proxySyncStoreCategory(ctx, task, loopMapInfo.StoreMapList[step], nil, nil, false, isContinueWhenError)
|
||||
return nil, err
|
||||
}, len(loopMapInfo.StoreMapList))
|
||||
t.AddChild(loopStoreTask).Run()
|
||||
_, err = loopStoreTask.GetResult(0)
|
||||
} else {
|
||||
_, err = handler.SyncStoreCategory(ctx, t, loopMapInfo.StoreMapList[0].StoreID, false)
|
||||
_, err = v.proxySyncStoreCategory(ctx, t, loopMapInfo.StoreMapList[0], nil, nil, false, isContinueWhenError)
|
||||
}
|
||||
}
|
||||
return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
|
||||
@@ -455,6 +454,13 @@ func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendo
|
||||
// return globals.IsProductEnv() && storeMap.StoreID != 102652 // 绿城四季鲜店
|
||||
// }
|
||||
|
||||
func (v *VendorSync) proxySyncStoreCategory(ctx *jxcontext.Context, parentTask tasksch.ITask, storeMap *model.StoreMap, nameIDs, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
// if isUseOldSyncLogic(storeMap) {
|
||||
// return v.GetStoreHandler(storeMap.VendorID).(partner.ISingleStoreHandler).SyncStoreCategory(ctx, parentTask, storeMap.StoreID, isAsync)
|
||||
// }
|
||||
return SyncStorCategories(ctx, parentTask, storeMap.VendorID, storeMap.StoreID, storeMap.VendorStoreID, nil, skuIDs, isAsync, isContinueWhenError)
|
||||
}
|
||||
|
||||
func (v *VendorSync) proxySyncStoreSku(ctx *jxcontext.Context, parentTask tasksch.ITask, storeMap *model.StoreMap, nameIDs, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
// if isUseOldSyncLogic(storeMap) {
|
||||
// return v.GetStoreHandler(storeMap.VendorID).SyncStoreSkus(ctx, parentTask, storeMap.StoreID, skuIDs, isAsync, isContinueWhenError)
|
||||
@@ -602,25 +608,25 @@ func (v *VendorSync) LoopMultiStoresVendors(ctx *jxcontext.Context, db *dao.DaoD
|
||||
return hint, makeSyncError(err)
|
||||
}
|
||||
|
||||
func (v *VendorSync) RefreshAllSkusID(ctx *jxcontext.Context, isAsync bool, vendorIDs []int, storeIDs []int) (hint string, err error) {
|
||||
task := tasksch.NewParallelTask("RefreshAllSkusID", nil, ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorID := batchItemList[0].(int)
|
||||
if handler := v.GetStoreHandler(vendorID); handler != nil {
|
||||
if multiHandler, ok := handler.(partner.IMultipleStoresHandler); ok {
|
||||
_, err = multiHandler.RefreshAllSkusID(ctx, task, false)
|
||||
} else if singleHandler, ok := handler.(partner.ISingleStoreHandler); ok {
|
||||
_, err = singleHandler.RefreshStoresAllSkusID(ctx, task, false, storeIDs)
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
}, vendorIDs)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
if !isAsync {
|
||||
_, err = task.GetResult(0)
|
||||
}
|
||||
return task.ID, err
|
||||
}
|
||||
// func (v *VendorSync) RefreshAllSkusID(ctx *jxcontext.Context, isAsync bool, vendorIDs []int, storeIDs []int) (hint string, err error) {
|
||||
// task := tasksch.NewParallelTask("RefreshAllSkusID", nil, ctx,
|
||||
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// vendorID := batchItemList[0].(int)
|
||||
// if handler := v.GetStoreHandler(vendorID); handler != nil {
|
||||
// if multiHandler, ok := handler.(partner.IMultipleStoresHandler); ok {
|
||||
// _, err = multiHandler.RefreshAllSkusID(ctx, task, false)
|
||||
// } else if singleHandler, ok := handler.(partner.ISingleStoreHandler); ok {
|
||||
// _, err = singleHandler.RefreshStoresAllSkusID(ctx, task, false, storeIDs)
|
||||
// }
|
||||
// }
|
||||
// return nil, err
|
||||
// }, vendorIDs)
|
||||
// tasksch.HandleTask(task, nil, true).Run()
|
||||
// if !isAsync {
|
||||
// _, err = task.GetResult(0)
|
||||
// }
|
||||
// return task.ID, err
|
||||
// }
|
||||
|
||||
func (v *VendorSync) RefreshAllStoresID(ctx *jxcontext.Context, isAsync bool, vendorIDs []int) (hint string, err error) {
|
||||
task := tasksch.NewParallelTask("RefreshAllStoresID", nil, ctx,
|
||||
|
||||
Reference in New Issue
Block a user