This commit is contained in:
richboo111
2024-01-30 09:38:16 +08:00
4 changed files with 9 additions and 20 deletions

View File

@@ -130,6 +130,10 @@ func (a *API) SetToken(token string) {
a.token = token a.token = token
} }
func (a *API) GetToken() string {
return a.token
}
func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{}, resultKey, trackInfo string) (retVal interface{}, err error) { func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{}, resultKey, trackInfo string) (retVal interface{}, err error) {
params := make(map[string]interface{}) params := make(map[string]interface{})
params["timestamp"] = time.Now().Unix() params["timestamp"] = time.Now().Unix()

View File

@@ -20,13 +20,13 @@ func init() {
baseapi.Init(sugarLogger) baseapi.Init(sugarLogger)
// 菜市 // 菜市
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") //api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园 // 果园
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") //api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超 //商超
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_qO_Kv9pX4lHVTb2IX19JzQ") //token_n4TwqCntWWuvQwAawzxC0w api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_lFvf_ibHSbTAoAIDQtFJQg") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := ` cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1; acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
` `

View File

@@ -125,6 +125,7 @@ type AppFood struct {
SecondaryCategoryCode string `json:"secondary_category_code"` SecondaryCategoryCode string `json:"secondary_category_code"`
SecondaryCategoryName string `json:"secondary_category_name"` SecondaryCategoryName string `json:"secondary_category_name"`
Sequence int `json:"sequence"` Sequence int `json:"sequence"`
UpcCode string `json:"upc_code"`
Skus string `json:"skus"` Skus string `json:"skus"`
SkuList []*SkuInfo `json:"skuList"` SkuList []*SkuInfo `json:"skuList"`
TagID int `json:"tag_id"` TagID int `json:"tag_id"`

View File

@@ -8,7 +8,6 @@ import (
"math" "math"
"strings" "strings"
"testing" "testing"
"time"
) )
// 测试添加分类 // 测试添加分类
@@ -27,7 +26,7 @@ func TestRetailCatUpdate(t *testing.T) {
// 测试获取门店分类列表 // 测试获取门店分类列表
func TestRetailCatList(t *testing.T) { func TestRetailCatList(t *testing.T) {
result, err := api.RetailCatList("19284062") result, err := api.RetailCatList("19696163")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -167,29 +166,14 @@ func TestBatchSetPrice(t *testing.T) {
fmt.Println(err) fmt.Println(err)
} }
func TestRetailDelete(t *testing.T) { func TestRetailDelete(t *testing.T) {
poiCode := "19907139" poiCode := "19696163"
for { for {
cat, _ := api.RetailCatList(poiCode)
for _, v := range cat {
api.RetailCatDelete(poiCode, "", v.Name, 1)
}
foodList, err1 := api.RetailListAll(poiCode, 0) foodList, err1 := api.RetailListAll(poiCode, 0)
if err1 != nil { if err1 != nil {
globals.SugarLogger.Debugf("====err1 := %v", err1) globals.SugarLogger.Debugf("====err1 := %v", err1)
return return
} }
i := 0
for _, v := range foodList {
err2 := api.RetailDelete("test_LiuLei", poiCode, v.AppFoodCode)
if err2 != nil {
globals.SugarLogger.Debugf("====err2 := %v", err1)
}
if i%40 == 0 {
time.Sleep(200 * time.Millisecond)
}
i++
}
return return
} }