1
This commit is contained in:
@@ -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年11月1日开始全面下线老接口(retail/sku/sellStatus),如开发者逾期未完成接口迁移,调用老接口失败所造成的相关问题或损失由商家自行承担。
|
||||
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{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
"food_data": string(utils.MustMarshal(foodData)),
|
||||
"sell_status": sellStatus,
|
||||
}, resultKeyMsg, trackInfo)
|
||||
if err != nil {
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
||||
failedFoodList, _ = handleRetailBatchResultByRegexp(errExt.ErrMsg())
|
||||
}
|
||||
}
|
||||
return failedFoodList, err
|
||||
}
|
||||
//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{}{
|
||||
// KeyAppPoiCode: poiCode,
|
||||
// "food_data": string(utils.MustMarshal(foodData)),
|
||||
// "sell_status": sellStatus,
|
||||
// }, resultKeyMsg, trackInfo)
|
||||
// if err != nil {
|
||||
// if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
||||
// failedFoodList, _ = handleRetailBatchResultByRegexp(errExt.ErrMsg())
|
||||
// }
|
||||
// }
|
||||
// return failedFoodList, err
|
||||
//}
|
||||
|
||||
// 此接口部分失败也返回成功,但错误消息格式(errorMsg, appFoodCode)与其它两个不一样
|
||||
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))
|
||||
}
|
||||
|
||||
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) {
|
||||
result, err := api.RetailSellStatus(utils.GetUUID(), "17088914", []*BareStoreFoodInfo{
|
||||
&BareStoreFoodInfo{
|
||||
|
||||
Reference in New Issue
Block a user