This commit is contained in:
邹宗楠
2023-11-20 09:36:43 +08:00
parent 7ed1aa66e9
commit 763580877a
8 changed files with 59 additions and 25 deletions

View File

@@ -23,16 +23,10 @@ func init() {
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园
api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nngsVP37s-HXY86xe85H7Q") //token_n4TwqCntWWuvQwAawzxC0w
<<<<<<< HEAD
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_rfAD6OxSVxkTeCO1XmNCZg") //token_n4TwqCntWWuvQwAawzxC0w
=======
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_rn25Arxm_1JSvQM6CWpJzQ") //token_n4TwqCntWWuvQwAawzxC0w
>>>>>>> 9b9473f25286de4923c0006093e3e6c0a928211c
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_vvkN5u8ZfJgjwCQrOUNNsQ") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
`

View File

@@ -93,15 +93,36 @@ func TestRetailCatDelete(t *testing.T) {
}
func TestRetailList(t *testing.T) {
result, err := api.RetailList("785527", 1, 100)
if err != nil {
t.Fatal(err)
offset := 0
skus := make(map[string]string, 0)
for {
result, err := api.RetailList("17211186", offset, 100)
if err != nil {
t.Fatal(err)
}
if len(result) == 0 {
t.Fatal("should have items")
}
for _, v := range result {
if v.SkuList != nil && len(v.SkuList) > 0 {
for _, v2 := range v.SkuList {
mapSkuList := utils.Struct2MapByJson(v2)
if mapSkuList["upc"].(string) != "" {
skus[mapSkuList["upc"].(string)] = mapSkuList["price"].(string)
break
}
}
}
}
if len(result) < 100 {
break
}
offset++
}
if len(result) == 0 {
t.Fatal("should have items")
}
t.Log(utils.Format4Output(result, false))
t.Log(len(result))
t.Log(utils.Format4Output(skus, false))
t.Log(utils.Format4Output(len(skus), false))
}
func TestRetailGet(t *testing.T) {