- fk
This commit is contained in:
@@ -29,13 +29,13 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
level := step + 1
|
||||
catList, err := dao.GetStoreCategories(db, model.VendorIDMTWM, storeID, level)
|
||||
if len(catList) > 0 {
|
||||
globals.SugarLogger.Debug(utils.Format4Output(catList, false))
|
||||
num += len(catList)
|
||||
task := tasksch.NewParallelTask(fmt.Sprintf("美团外卖SyncStoreCategory step2, level=%d", level), nil, userName, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
updateFields := []string{dao.GetSyncStatusStructField(model.VendorNames[model.VendorIDMTWM])}
|
||||
catInfo := batchItemList[0].(*dao.StoreCatSyncInfo)
|
||||
if globals.EnableStoreWrite && globals.EnableMtwmStoreWrite {
|
||||
if catInfo.MtwmSyncStatus&model.SyncFlagDeletedMask != 0 { // 删除
|
||||
globals.SugarLogger.Debugf("RetailCatDelete strStoreID:%s, MtwmID:%s", strStoreID, catInfo.MtwmID)
|
||||
err = api.MtwmAPI.RetailCatDelete(strStoreID, catInfo.MtwmID)
|
||||
} else if catInfo.MtwmSyncStatus&(model.SyncFlagNewMask|model.SyncFlagModifiedMask) != 0 { // 新增
|
||||
catName := catInfo.CatName
|
||||
@@ -57,6 +57,7 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
if catName == "" {
|
||||
panic("catName is empty")
|
||||
}
|
||||
globals.SugarLogger.Debugf("RetailCatUpdate strStoreID:%s, originName:%s, catName:%s, subCatName:%s, seq:%d", strStoreID, originName, catName, subCatName, catInfo.Seq)
|
||||
if err := api.MtwmAPI.RetailCatUpdate(strStoreID, originName, catName, subCatName, catInfo.Seq); err == nil {
|
||||
catInfo.MtwmID = catInfo.CatName
|
||||
updateFields = append(updateFields, dao.GetVendorThingIDStructField(model.VendorNames[model.VendorIDMTWM]))
|
||||
@@ -131,6 +132,7 @@ func (p *PurchaseHandler) SyncLocalStoreCategory(ctx *jxcontext.Context, db *dao
|
||||
// globals.SugarLogger.Debug(parentCatName, " ", catName, " ", localCat)
|
||||
if localCat == nil { // 本地分类就没有这个名字,直接删除
|
||||
if globals.EnableStoreWrite && globals.EnableMtwmStoreWrite {
|
||||
globals.SugarLogger.Debugf("RetailCatDelete2 strStoreID:%s, catName:%s", strStoreID, catName)
|
||||
if err = api.MtwmAPI.RetailCatDelete(strStoreID, catName); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -305,7 +307,7 @@ func (p *PurchaseHandler) FullSyncStoreSkus(ctx *jxcontext.Context, parentTask t
|
||||
case 3:
|
||||
_, err = p.SyncStoreCategory(ctx, rootTask, storeID, false)
|
||||
case 4:
|
||||
_, err = p.SyncStoreSkus(ctx, rootTask, storeID, nil, true, isContinueWhenError)
|
||||
// _, err = p.SyncStoreSkus(ctx, rootTask, storeID, nil, true, isContinueWhenError)
|
||||
}
|
||||
return nil, err
|
||||
}, 5)
|
||||
|
||||
Reference in New Issue
Block a user