This commit is contained in:
邹宗楠
2024-03-29 16:18:59 +08:00
parent 9bca4e8da3
commit fba05d1aef
6 changed files with 62 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ func init() {
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_tpzEJ-tqm6pxzVtD_t5L0g") //token_n4TwqCntWWuvQwAawzxC0w
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_n5zAb432R4VRR6GB1CNCuA") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
`

View File

@@ -251,8 +251,8 @@ func (a *API) RetailList(poiCode string, offset, limit int) (foodList []*AppFood
func (a *API) RetailListAll(poiCode string, offset int) (foodList []*AppFood, err error) {
data := make([]*AppFood, 0, 0)
offset = offset * GeneralMaxLimit
batchList, err2 := a.RetailList(poiCode, offset, GeneralMaxLimit) // GeneralMaxLimit
offset = offset * 1
batchList, err2 := a.RetailList(poiCode, offset, 1) // GeneralMaxLimit
if err = err2; err == nil {
data = append(data, batchList...)
}

View File

@@ -132,9 +132,9 @@ func TestRetailListCase(t *testing.T) {
if err := json.Unmarshal([]byte(result.Skus), &nowSkus); err != nil {
return
}
for _, ns := range nowSkus {
ns.Price = fmt.Sprintf("%.2f", utils.Str2Float64(ns.Price)+utils.Str2Float64(ns.Price)*0.1)
}
//for _, ns := range nowSkus {
// //ns.Price = fmt.Sprintf("%.2f", utils.Str2Float64(ns.Price)+utils.Str2Float64(ns.Price)*0.1)
//}
time.Sleep(time.Millisecond * 200)
skuInfo.Skus = nowSkus
if skuInfo.Skus[0].SkuID == "" || len(skuInfo.Skus) == 0 {
@@ -249,21 +249,34 @@ func TestRetailDelete(t *testing.T) {
Skus: []*BareStoreSkuInfo{
&BareStoreSkuInfo{
SkuID: fl.AppFoodCode,
Stock: "999999",
Stock: "99999",
},
},
})
}
i++
result, err := api.RetailSkuStock(utils.GetUUID(), testPoiCode, stockList)
result, err := api.RetailSkuStock(utils.GetUUID(), poiCode, stockList)
globals.SugarLogger.Debugf("===result :-%s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("===result :-%v", err)
}
}
func TestMap(t *testing.T) {
fmt.Println(16&4 != 0)
poiCode := "20802261"
stockList := make([]*BareStoreFoodInfo, 0, 100)
stockList = append(stockList, &BareStoreFoodInfo{
AppFoodCode: "mtcode_1772876609364365327",
Skus: []*BareStoreSkuInfo{
&BareStoreSkuInfo{
SkuID: "21761610084",
Stock: "99999",
},
},
})
result, err := api.RetailSkuStock(utils.GetUUID(), poiCode, stockList)
globals.SugarLogger.Debugf("===result :-%s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("===result :-%v", err)
}
func TestRetailDat(t *testing.T) {
@@ -365,7 +378,7 @@ func TestRetailSkuStock(t *testing.T) {
Skus: []*BareStoreSkuInfo{
&BareStoreSkuInfo{
SkuID: "2212",
Price: "1.2",
//Price: "1.2",
Stock: "123",
},
},
@@ -393,7 +406,7 @@ func TestRetailSkuSellStatus(t *testing.T) {
Skus: []*BareStoreSkuInfo{
&BareStoreSkuInfo{
SkuID: "23841",
Price: "1.2",
//Price: "1.2",
Stock: "123",
},
},