根据名字查询upc码,获取京东等级修改

This commit is contained in:
苏尹岚
2019-12-16 16:12:56 +08:00
parent 1b4de9a762
commit 245e793ce3
2 changed files with 52 additions and 1 deletions

View File

@@ -1302,6 +1302,9 @@ func GetJdUpcCodeByName(ctx *jxcontext.Context, name, upcCode string) (productIn
pageSize = 30
pageNoList []int
)
if name == "" && upcCode == "" {
return nil, fmt.Errorf("至少输入一个条件查询商品名或者upc码")
}
for i := 1; i < pageNo+1; i++ {
pageNoList = append(pageNoList, i)
}
@@ -1312,6 +1315,16 @@ func GetJdUpcCodeByName(ctx *jxcontext.Context, name, upcCode string) (productIn
if err != nil {
return retVal, err
}
if len(productInfo) > 0 {
for _, v := range productInfo {
productInfo2, _ := api.ShowAPI.GetProductInfoByBarCode(v.UpcCode)
if productInfo2 != nil {
v.Name = productInfo2.Name
v.SpecQuality = productInfo2.SpecQuality
v.SpecUnit = productInfo2.SpecUnit
}
}
}
retVal = productInfo
return retVal, err
}, pageNoList)