This commit is contained in:
richboo111
2022-11-16 14:50:54 +08:00
parent 02ca4912a2
commit 99218d8524
3 changed files with 23 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package mtwmapi
import (
"fmt"
"testing"
"git.rosy.net.cn/baseapi"
@@ -19,13 +20,13 @@ func init() {
baseapi.Init(sugarLogger)
// 菜市
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
// 果园
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nH_IlcWQKAkZBqklwItNRw") //token_nH_IlcWQKAkZBqklwItNRw
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nH_IlcWQKAkZBqklwItNRw") //token_nH_IlcWQKAkZBqklwItNRw
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
`
@@ -41,10 +42,11 @@ func TestAccessAPI(t *testing.T) {
}
func TestGetOAuthCode(t *testing.T) {
result, err := api.GetOAuthCode("8967897")
result, err := api.GetOAuthCode("12422751")
if err != nil {
t.Fatal(err)
}
fmt.Println(utils.Format4Output(result, false))
t.Log(utils.Format4Output(result, false))
}
@@ -53,14 +55,16 @@ func TestGetAccessToken(t *testing.T) {
if err != nil {
t.Fatal(err)
}
fmt.Println(utils.Format4Output(result, false))
t.Log(utils.Format4Output(result, false))
}
func TestGetAccessToken2(t *testing.T) {
result, err := api.GetAccessToken2("11011885") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
result, err := api.GetAccessToken2("12422751") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
if err != nil {
t.Fatal(err)
}
fmt.Println(utils.Format4Output(result.AccessToken, false))
t.Log(utils.Format4Output(result, false))
}
@@ -69,5 +73,6 @@ func TestRefreshAccessToken(t *testing.T) {
if err != nil {
t.Fatal(err)
}
fmt.Println(utils.Format4Output(result, false))
t.Log(utils.Format4Output(result, false))
}

View File

@@ -496,6 +496,7 @@ func (a *API) BatchSetRestockingPrice(trackInfo, appPoiCode string, spuData []*S
"spu_data": spuData,
}, resultKeyMsg, trackInfo)
globals.SugarLogger.Debugf("BatchSetRestockingPrice retVal=============%v", retVal)
globals.SugarLogger.Debugf("BatchSetRestockingPrice err===========%v", err)
return err
}

View File

@@ -1,6 +1,7 @@
package mtwmapi
import (
"fmt"
"testing"
"git.rosy.net.cn/baseapi/utils"
@@ -95,6 +96,18 @@ func TestRetailCatSkuBatchDelete(t *testing.T) {
}
}
//批量更新商品进货价
func TestBatchSetPrice(t *testing.T) {
param := []*SpuData{
{
AppSpuCode: "25420",
SkuID: "11395394828",
PurchasePrice: "50",
},
}
err := api.BatchSetRestockingPrice(utils.GetUUID(), "12422751", param)
fmt.Println(err)
}
func TestRetailDelete(t *testing.T) {
err := api.RetailDelete(utils.GetUUID(), testPoiCode, "32427")
if err != nil {