diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index aae0acea1..39c524e5d 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -328,7 +328,7 @@ func SetStoreCategorySyncStatus2(db *dao.DaoDB, storeIDs []int, catIDs []int, sy return num, nil } -func ReorderCategories(ctx *jxcontext.Context, parentID int, categoryIDs []int, userName string, isExd bool) (err error) { +func ReorderCategories(ctx *jxcontext.Context, parentID int, categoryIDs []int, userName string, isExd bool, onlySort int) (err error) { var cats []*model.SkuCategory db := dao.GetDB() if err = dao.GetEntitiesByKV(db, &cats, utils.Params2Map(model.FieldParentID, parentID), false); err == nil { @@ -378,14 +378,19 @@ func ReorderCategories(ctx *jxcontext.Context, parentID int, categoryIDs []int, } } dao.Commit(db, txDB) - if _, err = SetStoreCategorySyncStatus2(db, nil, categoryIDs, model.SyncFlagModifiedMask); err != nil { - return err - } // 同步平台分类排序 if _, err := CurVendorSync.SyncReorderCategories(ctx, db, parentID, false, userName); err != nil { return err } + if onlySort == model.YES { + return nil + } + + if _, err = SetStoreCategorySyncStatus2(db, nil, categoryIDs, model.SyncFlagModifiedMask); err != nil { + return err + } + // 同步门店分类 CurVendorSync.SyncStoresCategory(ctx, db, nil, nil, false, true, true) } diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 1f7d5fbe4..ea0614765 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -701,17 +701,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag // api.JdShop2API.SetCookieWithStr(configs[0].Value) // } } - if storeID == 668767 { - globals.SugarLogger.Debugf("createList=== %s", utils.Format4Output(createList, false)) - globals.SugarLogger.Debugf("updateList=== %s", utils.Format4Output(updateList, false)) - globals.SugarLogger.Debugf("deleteList=== %s", utils.Format4Output(deleteList, false)) - globals.SugarLogger.Debugf("stockList=== %s", utils.Format4Output(stockList, false)) - globals.SugarLogger.Debugf("onlineList=== %s", utils.Format4Output(onlineList, false)) - globals.SugarLogger.Debugf("offlineList=== %s", utils.Format4Output(offlineList, false)) - globals.SugarLogger.Debugf("priceList=== %s", utils.Format4Output(priceList, false)) - globals.SugarLogger.Debugf("updateItems=== %s", utils.Format4Output(updateItems, false)) - globals.SugarLogger.Debugf("reorderSkuMap=== %s", utils.Format4Output(reorderSkuMap, false)) - } task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { diff --git a/controllers/cms_sku.go b/controllers/cms_sku.go index 79d0cbd8d..636461648 100644 --- a/controllers/cms_sku.go +++ b/controllers/cms_sku.go @@ -106,6 +106,7 @@ func (c *SkuController) UpdateCategory() { // @Param categoryID formData int true "父ID" // @Param categoryIDs formData string true "同一父类别下的所有子类别ID列表([1,2,3,4])" // @Param isExd query bool false "是否要查饿鲜达分类" +// @Param onlySort query int false "1-仅仅排序/其他就是排序加同步分类" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /ReorderCategories [put] @@ -113,7 +114,7 @@ func (c *SkuController) ReorderCategories() { c.callReorderCategories(func(params *tSkuReorderCategoriesParams) (retVal interface{}, errCode string, err error) { var idList []int if err = utils.UnmarshalUseNumber([]byte(params.CategoryIDs), &idList); err == nil { - err = cms.ReorderCategories(params.Ctx, params.CategoryID, idList, params.Ctx.GetUserName(), params.IsExd) + err = cms.ReorderCategories(params.Ctx, params.CategoryID, idList, params.Ctx.GetUserName(), params.IsExd, params.OnlySort) } return retVal, "", err })