美团外卖的商家分类转换时,code在有值时转换为VendorCatID

This commit is contained in:
gazebo
2019-10-17 18:43:21 +08:00
parent 7b26c9d130
commit 54bee1e26f

View File

@@ -57,12 +57,15 @@ func (p *PurchaseHandler) GetStoreAllCategories(ctx *jxcontext.Context, storeID
func convertVendorCatList(remoteCats []*mtwmapi.RetailCategoryInfo) (cats []*partner.BareCategoryInfo) { func convertVendorCatList(remoteCats []*mtwmapi.RetailCategoryInfo) (cats []*partner.BareCategoryInfo) {
for _, rCat := range remoteCats { for _, rCat := range remoteCats {
cat := &partner.BareCategoryInfo{ cat := &partner.BareCategoryInfo{
VendorCatID: rCat.Name, VendorCatID: rCat.Code,
Name: rCat.Name, Name: rCat.Name,
Level: rCat.Level, Level: rCat.Level,
Seq: rCat.Sequence, Seq: rCat.Sequence,
Children: convertVendorCatList(rCat.Children), Children: convertVendorCatList(rCat.Children),
} }
if cat.VendorCatID == "" {
cat.VendorCatID = rCat.Name
}
cats = append(cats, cat) cats = append(cats, cat)
} }
return cats return cats