添加自动获取品牌

This commit is contained in:
邹宗楠
2023-02-21 11:09:12 +08:00
parent 8cdc3078be
commit babacd5233
6 changed files with 42 additions and 13 deletions

View File

@@ -1038,6 +1038,7 @@ func (a *API) GetJdUpcCodeByName(name, upcCode string, pageNo, pageSize int) (pr
UpcCode: v.(map[string]interface{})["upcCode"].(string),
Weight: float32(utils.Interface2Float64WithDefault(v.(map[string]interface{})["weight"], 0) * 1000),
ImgList: ImgList,
BrandName: v.(map[string]interface{})["brandName"].(string),
}
productInfos = append(productInfos, productInfo)
}

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils"
"strings"
"testing"
)
@@ -208,14 +209,15 @@ func TestC(t *testing.T) {
// api.GetJdStoreLevel("320406", "11732427", 1)
//}
//
//func TestGetJdUpcCodeByName(t *testing.T) {
// result, err := api.GetJdUpcCodeByName("", "6920174736731", 1, 5)
// if err != nil {
// t.Fatal(err)
// }
// t.Log(utils.Format4Output(result, false))
//}
//
func TestGetJdUpcCodeByName(t *testing.T) {
result, err := api.GetJdUpcCodeByName("", "9556771007300", 1, 5)
if err != nil {
t.Fatal(err)
}
t.Log(strings.Split(result[0].OriginalName, " ")[0])
t.Log(utils.Format4Output(result, false))
}
//func TestGetJdSkuDirectPrice(t *testing.T) {
// result, err := api.GetJdSkuDirectPrice(31031)
// fmt.Println("test1", result, err)