1'
This commit is contained in:
@@ -328,7 +328,7 @@ func SetStoreCategorySyncStatus2(db *dao.DaoDB, storeIDs []int, catIDs []int, sy
|
|||||||
return num, nil
|
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
|
var cats []*model.SkuCategory
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
if err = dao.GetEntitiesByKV(db, &cats, utils.Params2Map(model.FieldParentID, parentID), false); err == nil {
|
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)
|
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 {
|
if _, err := CurVendorSync.SyncReorderCategories(ctx, db, parentID, false, userName); err != nil {
|
||||||
return err
|
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)
|
CurVendorSync.SyncStoresCategory(ctx, db, nil, nil, false, true, true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -701,17 +701,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
|||||||
// api.JdShop2API.SetCookieWithStr(configs[0].Value)
|
// 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,
|
task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx,
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ func (c *SkuController) UpdateCategory() {
|
|||||||
// @Param categoryID formData int true "父ID"
|
// @Param categoryID formData int true "父ID"
|
||||||
// @Param categoryIDs formData string true "同一父类别下的所有子类别ID列表([1,2,3,4])"
|
// @Param categoryIDs formData string true "同一父类别下的所有子类别ID列表([1,2,3,4])"
|
||||||
// @Param isExd query bool false "是否要查饿鲜达分类"
|
// @Param isExd query bool false "是否要查饿鲜达分类"
|
||||||
|
// @Param onlySort query int false "1-仅仅排序/其他就是排序加同步分类"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /ReorderCategories [put]
|
// @router /ReorderCategories [put]
|
||||||
@@ -113,7 +114,7 @@ func (c *SkuController) ReorderCategories() {
|
|||||||
c.callReorderCategories(func(params *tSkuReorderCategoriesParams) (retVal interface{}, errCode string, err error) {
|
c.callReorderCategories(func(params *tSkuReorderCategoriesParams) (retVal interface{}, errCode string, err error) {
|
||||||
var idList []int
|
var idList []int
|
||||||
if err = utils.UnmarshalUseNumber([]byte(params.CategoryIDs), &idList); err == nil {
|
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
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user