获取类目id
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package jdshop
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
@@ -39,5 +40,19 @@ func (p *PurchaseHandler) UploadImg(ctx *jxcontext.Context, vendorOrgCode, imgUR
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCats []*model.SkuVendorCategory, err error) {
|
||||
result, err := api.JdShopAPI.FindVendorCategories()
|
||||
for _, v := range result {
|
||||
cat := &model.SkuVendorCategory{
|
||||
VendorID: model.VendorIDJDShop,
|
||||
Name: v.Name,
|
||||
Level: v.Lev,
|
||||
VendorCategoryID: utils.Int2Str(v.ID),
|
||||
}
|
||||
if v.Lev > 1 {
|
||||
cat.ParentID = utils.Int2Str(v.Fid)
|
||||
cat.IsLeaf = 1
|
||||
}
|
||||
vendorCats = append(vendorCats, cat)
|
||||
}
|
||||
return vendorCats, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user