处理创建分类是的父子关系

This commit is contained in:
gazebo
2019-12-12 15:53:17 +08:00
parent 099ba06d04
commit 4d15303149
2 changed files with 74 additions and 14 deletions

View File

@@ -71,8 +71,12 @@ func (p *PurchaseHandler) GetAllCategories(ctx *jxcontext.Context, vendorOrgCode
func (p *PurchaseHandler) CreateCategory2(ctx *jxcontext.Context, cat *dao.SkuStoreCatInfo) (err error) {
globals.SugarLogger.Debugf("CreateCategory2 cat:%s", utils.Format4Output(cat, true))
parentID := int64(0)
if cat.Level != 1 {
parentID = utils.Str2Int64(cat.ParentVendorCatID)
}
if globals.EnableJdStoreWrite {
result, err2 := getAPI(cat.VendorOrgCode).AddShopCategory(utils.Str2Int64(cat.ParentVendorCatID), cat.Name, int(cat.Level), cat.Seq, ctx.GetUserName())
result, err2 := getAPI(cat.VendorOrgCode).AddShopCategory(parentID, cat.Name, int(cat.Level), cat.Seq, ctx.GetUserName())
if err = err2; err == nil {
if jdID := utils.Str2Int64WithDefault(result, 0); jdID != 0 {
cat.VendorCatID = utils.Int64ToStr(jdID)