饿鲜达分类修改等接口修改

This commit is contained in:
苏尹岚
2020-02-13 17:07:35 +08:00
parent 0477de8916
commit 721c0eda3d
2 changed files with 8 additions and 3 deletions

View File

@@ -254,7 +254,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) (err error) { func ReorderCategories(ctx *jxcontext.Context, parentID int, categoryIDs []int, userName string, isExd bool) (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 {
@@ -279,7 +279,11 @@ func ReorderCategories(ctx *jxcontext.Context, parentID int, categoryIDs []int,
dao.Rollback(db) dao.Rollback(db)
return fmt.Errorf("分类:%d不在%d分类下", v, parentID) return fmt.Errorf("分类:%d不在%d分类下", v, parentID)
} }
catsMap[v].Seq = k if isExd {
catsMap[v].ExdSeq = k
} else {
catsMap[v].Seq = k
}
catsMap[v].LastOperator = ctx.GetUserName() catsMap[v].LastOperator = ctx.GetUserName()
if _, err = dao.UpdateEntity(db, catsMap[v]); err != nil { if _, err = dao.UpdateEntity(db, catsMap[v]); err != nil {
dao.Rollback(db) dao.Rollback(db)

View File

@@ -87,6 +87,7 @@ func (c *SkuController) UpdateCategory() {
// @Param token header string true "认证token" // @Param token header string true "认证token"
// @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 "是否要查饿鲜达分类"
// @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]
@@ -94,7 +95,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()) err = cms.ReorderCategories(params.Ctx, params.CategoryID, idList, params.Ctx.GetUserName(), params.IsExd)
} }
return retVal, "", err return retVal, "", err
}) })