- mtwmapi
This commit is contained in:
125
platformapi/mtwmapi/order.go
Normal file
125
platformapi/mtwmapi/order.go
Normal file
@@ -0,0 +1,125 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
MaxBatchPullPhoneNumberLimit = 1000
|
||||
)
|
||||
|
||||
func (a *API) OrderReceived(orderID int64) (err error) {
|
||||
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderConfirm(orderID int64) (err error) {
|
||||
_, err = a.AccessAPI("order/confirm", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderCancel(orderID int64) (err error) {
|
||||
_, err = a.AccessAPI("order/cancel", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderDelivering(orderID int64) (err error) {
|
||||
_, err = a.AccessAPI("order/delivering", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderArrived(orderID int64) (err error) {
|
||||
_, err = a.AccessAPI("order/arrived", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderRefundAgree(orderID int64, reason string) (err error) {
|
||||
_, err = a.AccessAPI("order/refund/agree", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
"reason": reason,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderRefundReject(orderID int64, reason string) (err error) {
|
||||
_, err = a.AccessAPI("order/refund/reject", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
"reason": reason,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderViewStatus(orderID int64) (status int, err error) {
|
||||
result, err := a.AccessAPI("order/viewstatus", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
if err == nil {
|
||||
// baseapi.SugarLogger.Debug(result)
|
||||
return int(utils.MustInterface2Int64(result.(map[string]interface{})["status"])), nil
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
|
||||
func (a *API) OrderGetOrderDetail(orderID int64, isMTLogistics bool) (orderInfo map[string]interface{}, err error) {
|
||||
params := map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
}
|
||||
if isMTLogistics {
|
||||
params["is_mt_logistics"] = 1
|
||||
}
|
||||
result, err := a.AccessAPI("order/getOrderDetail", true, params)
|
||||
if err == nil {
|
||||
return result.(map[string]interface{}), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (a *API) OrderLogisticsPush(orderID int64, reason string) (err error) {
|
||||
_, err = a.AccessAPI("order/logistics/push", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderLogisticsCancel(orderID int64, reason string) (err error) {
|
||||
_, err = a.AccessAPI("order/logistics/cancel", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) OrderLogisticsStatus(orderID int64) (status map[string]interface{}, err error) {
|
||||
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
})
|
||||
if err == nil {
|
||||
return result.(map[string]interface{}), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// limit最大为MaxBatchPullPhoneNumberLimit = 1000
|
||||
func (a *API) OrderBatchPullPhoneNumber(poiCode string, offset, limit int) (realNumberList []map[string]interface{}, err error) {
|
||||
params := map[string]interface{}{
|
||||
"offset": offset,
|
||||
"limit": limit,
|
||||
}
|
||||
if poiCode != "" {
|
||||
params[KeyAppPoiCode] = poiCode
|
||||
}
|
||||
result, err := a.AccessAPI("order/batchPullPhoneNumber", false, params)
|
||||
if err == nil {
|
||||
return utils.Slice2MapSlice(result.([]interface{})), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
Reference in New Issue
Block a user