1
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -29,7 +29,7 @@ func TestQueryOneStore(t *testing.T) {
|
|||||||
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "51658", "")
|
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "51658", "")
|
||||||
//token, err := api.GetAccessToken()
|
//token, err := api.GetAccessToken()
|
||||||
api.accessToken = "45c49b75-d47e-4145-b38d-fda8b5ebf3a9"
|
api.accessToken = "45c49b75-d47e-4145-b38d-fda8b5ebf3a9"
|
||||||
data, err := api.GetStore("800293")
|
data, err := api.GetStore("668668")
|
||||||
fmt.Println(data)
|
fmt.Println(data)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ func TestClient(t *testing.T) {
|
|||||||
|
|
||||||
// 预下单
|
// 预下单
|
||||||
func TestGetOrder(t *testing.T) {
|
func TestGetOrder(t *testing.T) {
|
||||||
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
|
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "51658", "tMNyQk52Q7VA36Q9XXbTdX")
|
||||||
token, _ := api.GetAccessToken()
|
token, _ := api.GetAccessToken()
|
||||||
api.accessToken = token.BusinessDataObj.AccessToken
|
api.accessToken = token.BusinessDataObj.AccessToken
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,20 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestSyncMap(t *testing.T) {
|
||||||
|
var EBaiVendorStoreIDList = new(sync.Map)
|
||||||
|
|
||||||
|
fmt.Println(EBaiVendorStoreIDList.Load("1"))
|
||||||
|
EBaiVendorStoreIDList.Store("2", 1)
|
||||||
|
value, ok := EBaiVendorStoreIDList.Load("2")
|
||||||
|
fmt.Println(value)
|
||||||
|
fmt.Println(ok)
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//import (
|
//import (
|
||||||
// "fmt"
|
// "fmt"
|
||||||
|
|||||||
@@ -352,19 +352,19 @@ func (a *API) RetailSkuStock(trackInfo, poiCode string, foodData []*BareStoreFoo
|
|||||||
// 此接口已准备废弃
|
// 此接口已准备废弃
|
||||||
// 2019年9月17日开放平台已上线新接口【retail/sellStatus】,用于零售类商家批量更新商品售卖状态。请已接入老接口(retail/sku/sellStatus)的开发者在2019年10月31日前完成接口迁移,使用新接口的请求地址https://waimaiopen.meituan.com/api/v1/retail/sellStatus。
|
// 2019年9月17日开放平台已上线新接口【retail/sellStatus】,用于零售类商家批量更新商品售卖状态。请已接入老接口(retail/sku/sellStatus)的开发者在2019年10月31日前完成接口迁移,使用新接口的请求地址https://waimaiopen.meituan.com/api/v1/retail/sellStatus。
|
||||||
// 开放平台将于2019年11月1日开始全面下线老接口(retail/sku/sellStatus),如开发者逾期未完成接口迁移,调用老接口失败所造成的相关问题或损失由商家自行承担。
|
// 开放平台将于2019年11月1日开始全面下线老接口(retail/sku/sellStatus),如开发者逾期未完成接口迁移,调用老接口失败所造成的相关问题或损失由商家自行承担。
|
||||||
func (a *API) RetailSkuSellStatus(trackInfo, poiCode string, foodData []*BareStoreFoodInfo, sellStatus int) (failedFoodList []*AppFoodResult, err error) {
|
//func (a *API) RetailSkuSellStatus(trackInfo, poiCode string, foodData []*BareStoreFoodInfo, sellStatus int) (failedFoodList []*AppFoodResult, err error) {
|
||||||
_, err = a.AccessAPI2("retail/sku/sellStatus", false, map[string]interface{}{
|
// _, err = a.AccessAPI2("retail/sku/sellStatus", false, map[string]interface{}{
|
||||||
KeyAppPoiCode: poiCode,
|
// KeyAppPoiCode: poiCode,
|
||||||
"food_data": string(utils.MustMarshal(foodData)),
|
// "food_data": string(utils.MustMarshal(foodData)),
|
||||||
"sell_status": sellStatus,
|
// "sell_status": sellStatus,
|
||||||
}, resultKeyMsg, trackInfo)
|
// }, resultKeyMsg, trackInfo)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
// if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
||||||
failedFoodList, _ = handleRetailBatchResultByRegexp(errExt.ErrMsg())
|
// failedFoodList, _ = handleRetailBatchResultByRegexp(errExt.ErrMsg())
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return failedFoodList, err
|
// return failedFoodList, err
|
||||||
}
|
//}
|
||||||
|
|
||||||
// 此接口部分失败也返回成功,但错误消息格式(errorMsg, appFoodCode)与其它两个不一样
|
// 此接口部分失败也返回成功,但错误消息格式(errorMsg, appFoodCode)与其它两个不一样
|
||||||
func (a *API) RetailSellStatus(trackInfo, poiCode string, foodData []*BareStoreFoodInfo, sellStatus int) (failedFoodList []*AppFoodResult, err error) {
|
func (a *API) RetailSellStatus(trackInfo, poiCode string, foodData []*BareStoreFoodInfo, sellStatus int) (failedFoodList []*AppFoodResult, err error) {
|
||||||
|
|||||||
@@ -401,43 +401,6 @@ func TestRetailSkuStock(t *testing.T) {
|
|||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRetailSkuSellStatus(t *testing.T) {
|
|
||||||
result, err := api.RetailSkuSellStatus(utils.GetUUID(), testPoiCode, []*BareStoreFoodInfo{
|
|
||||||
&BareStoreFoodInfo{
|
|
||||||
AppFoodCode: "23841",
|
|
||||||
Skus: []*BareStoreSkuInfo{
|
|
||||||
&BareStoreSkuInfo{
|
|
||||||
SkuID: "23841",
|
|
||||||
//Price: "1.2",
|
|
||||||
Stock: "123",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&BareStoreFoodInfo{
|
|
||||||
AppFoodCode: "23840",
|
|
||||||
Skus: []*BareStoreSkuInfo{
|
|
||||||
&BareStoreSkuInfo{
|
|
||||||
SkuID: "23840",
|
|
||||||
Stock: "123",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&BareStoreFoodInfo{
|
|
||||||
AppFoodCode: "2384999",
|
|
||||||
Skus: []*BareStoreSkuInfo{
|
|
||||||
&BareStoreSkuInfo{
|
|
||||||
SkuID: "2384999",
|
|
||||||
Stock: "123",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}, SellStatusOffline)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
t.Log(utils.Format4Output(result, false))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRetailSellStatus(t *testing.T) {
|
func TestRetailSellStatus(t *testing.T) {
|
||||||
result, err := api.RetailSellStatus(utils.GetUUID(), "17088914", []*BareStoreFoodInfo{
|
result, err := api.RetailSellStatus(utils.GetUUID(), "17088914", []*BareStoreFoodInfo{
|
||||||
&BareStoreFoodInfo{
|
&BareStoreFoodInfo{
|
||||||
|
|||||||
Reference in New Issue
Block a user