- 美团外卖SyncStoreSkus中,只处理与相应的skuIDs相关的分类信息
This commit is contained in:
@@ -97,7 +97,7 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
// 远程无,本地有,映射无, --> 添加本地
|
||||
// 远程无,本地有,映射有, --> 同步标记改为新增
|
||||
// hint,如果是异步,返回的是任务ID,如果是同步,返回是本次需要同步的目录数
|
||||
func (p *PurchaseHandler) SyncLocalStoreCategory(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, isCheckRemote bool) (hint string, err error) {
|
||||
func (p *PurchaseHandler) SyncLocalStoreCategory(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, isCheckRemote bool, skuIDs []int) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("mtwm SyncLocalStoreCategory storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
@@ -105,7 +105,7 @@ func (p *PurchaseHandler) SyncLocalStoreCategory(ctx *jxcontext.Context, db *dao
|
||||
catMap := make([]map[string]*dao.SkuStoreCatInfo, 2)
|
||||
for i := 0; i < 2; i++ {
|
||||
catMap[i] = make(map[string]*dao.SkuStoreCatInfo)
|
||||
localCats, err := dao.GetSkusCategories(db, model.VendorIDMTWM, storeID, nil, i+1)
|
||||
localCats, err := dao.GetSkusCategories(db, model.VendorIDMTWM, storeID, skuIDs, i+1)
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(localCats, false))
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -216,7 +216,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
globals.SugarLogger.Debugf("mtwm SyncStoreSkus storeID:%d, skuIDs:%v, isContinueWhenError:%t, userName:%s", storeID, skuIDs, isContinueWhenError, ctx.GetUserName())
|
||||
db := dao.GetDB()
|
||||
for i := 0; i < 3; i++ { // 最多重试三次
|
||||
if hint, err = p.SyncLocalStoreCategory(ctx, db, storeID, false); err != nil {
|
||||
if hint, err = p.SyncLocalStoreCategory(ctx, db, storeID, false, skuIDs); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if hint != "0" {
|
||||
@@ -335,7 +335,7 @@ func (p *PurchaseHandler) FullSyncStoreSkus(ctx *jxcontext.Context, parentTask t
|
||||
_, err = dao.SetStoreCategorySyncStatus(db, model.VendorIDMTWM, storeID, nil, model.SyncFlagNewMask)
|
||||
}
|
||||
case 3:
|
||||
_, err = p.SyncLocalStoreCategory(ctx, db, storeID, true)
|
||||
_, err = p.SyncLocalStoreCategory(ctx, db, storeID, true, nil)
|
||||
case 4:
|
||||
_, err = p.SyncStoreCategory(ctx, rootTask, storeID, false)
|
||||
case 5:
|
||||
|
||||
Reference in New Issue
Block a user