修改自配送,状态,添加打印机打印参数
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"time"
|
||||
@@ -413,7 +414,6 @@ func (a *API) OrderDelivering(orderID int64) (err error) {
|
||||
return errors.New("美团系统操作异常,订单查询ng")
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -697,3 +697,70 @@ func (a *API) OrderStatusAndPsInfo(params map[string]interface{}) (err error) {
|
||||
_, err = a.AccessAPI("ecommerce/order/logistics/sync", false, params)
|
||||
return err
|
||||
}
|
||||
|
||||
// 获取取消跑腿理由刘表
|
||||
// https://open-shangou.meituan.com/home/docDetail/482
|
||||
func (a *API) GetCancelDeliveryReason(orderId int64, appPoiCode string) ([]*ReasonList, error) {
|
||||
data, err := a.AccessAPI("order/getCancelDeliveryReason", false, map[string]interface{}{"order_id": orderId, "app_poi_code": appPoiCode})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &CancelDeliveryReasonList{}
|
||||
if err := json.Unmarshal([]byte(utils.Interface2String(data)), result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Data.ReasonList, nil
|
||||
}
|
||||
|
||||
type CancelDeliveryReasonList struct {
|
||||
Data *Data `json:"data"`
|
||||
}
|
||||
|
||||
type Data struct {
|
||||
Code int `json:"code"`
|
||||
Title string `json:"title"`
|
||||
ReasonList []*ReasonList `json:"reasonList"`
|
||||
Msg string `json:"msg"`
|
||||
DeliveryStatus int `json:"deliveryStatus"`
|
||||
}
|
||||
|
||||
type ReasonList struct {
|
||||
Code string `json:"code"`
|
||||
Content string `json:"content"`
|
||||
PreCancelCode int `json:"preCancelCode"`
|
||||
PreCancelMsg string `json:"preCancelMsg"`
|
||||
}
|
||||
|
||||
// 取消跑腿配送
|
||||
func (a *API) CancelLogisticsByWmOrderId(param *CancelOrderParam) error {
|
||||
data, err := a.AccessAPI("order/getCancelDeliveryReason", false, utils.Struct2FlatMap(param))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
result := &ResultMsg{}
|
||||
if err := json.Unmarshal([]byte(utils.Interface2String(data)), result); err != nil {
|
||||
return err
|
||||
}
|
||||
if result.Data != "ok" {
|
||||
return errors.New(result.Error.Msg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ResultMsg struct {
|
||||
Data string `json:"data"`
|
||||
Error *struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
}
|
||||
|
||||
// 取消跑腿配送请求参数
|
||||
type CancelOrderParam struct {
|
||||
ReasonCode string `json:"reason_code"` // 取消原因code 请开发者一定要先调用
|
||||
DetailContent string `json:"detail_content"` // 取消原因
|
||||
AppPoiCode string `json:"app_poi_code"` // 门店号
|
||||
OrderId string `json:"order_id"` // 订单id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user