根据名字查询upc码,获取京东等级修改
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user