达达新接口
This commit is contained in:
@@ -49,20 +49,6 @@ const (
|
||||
CargoTypeOther = 5 // 其他
|
||||
)
|
||||
|
||||
type OperateOrderRequiredParams struct {
|
||||
ShopNo string `json:"shop_no"`
|
||||
OriginID string `json:"origin_id"`
|
||||
CityCode string `json:"city_code"`
|
||||
CargoPrice float64 `json:"cargo_price"`
|
||||
IsPrepay int `json:"is_prepay"`
|
||||
ReceiverName string `json:"receiver_name"`
|
||||
ReceiverAddress string `json:"receiver_address"`
|
||||
ReceiverLat float64 `json:"receiver_lat"`
|
||||
ReceiverLng float64 `json:"receiver_lng"`
|
||||
ReceiverPhone string `json:"receiver_phone"`
|
||||
ReceiverTel string `json:"receiver_tel"`
|
||||
}
|
||||
|
||||
type OperateOrderParams struct {
|
||||
// 以下为必要参数
|
||||
|
||||
@@ -141,19 +127,9 @@ type OrderInfo struct {
|
||||
TransporterPhone string `json:"transporterPhone"`
|
||||
}
|
||||
|
||||
func (a *API) QueryOrderInfo(orderID string) (retVal map[string]interface{}, err error) {
|
||||
params := make(map[string]interface{})
|
||||
params["order_id"] = orderID
|
||||
result, err := a.AccessAPI("api/order/status/query", params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Result.(map[string]interface{}), nil
|
||||
}
|
||||
|
||||
// 订单详情查询
|
||||
// http://newopen.imdada.cn/#/development/file/statusQuery?_k=7ou2o1
|
||||
func (a *API) QueryOrderInfo2(orderID string) (order *OrderInfo, err error) {
|
||||
func (a *API) QueryOrderInfo(orderID string) (order *OrderInfo, err error) {
|
||||
params := make(map[string]interface{})
|
||||
params["order_id"] = orderID
|
||||
result, err := a.AccessAPI("api/order/status/query", params)
|
||||
@@ -163,37 +139,7 @@ func (a *API) QueryOrderInfo2(orderID string) (order *OrderInfo, err error) {
|
||||
return order, err
|
||||
}
|
||||
|
||||
// func map2CreateOrderResponse(mapData map[string]interface{}) *CreateOrderResponse {
|
||||
// retVal := new(CreateOrderResponse)
|
||||
// retVal.Distance = utils.MustInterface2Float64(mapData["distance"])
|
||||
// retVal.Fee = utils.MustInterface2Float64(mapData["fee"])
|
||||
// retVal.DeliverFee = utils.MustInterface2Float64(mapData["deliverFee"])
|
||||
// retVal.DeliveryNo = utils.Interface2String(mapData["deliveryNo"])
|
||||
|
||||
// if value, ok := mapData["couponFee"]; ok {
|
||||
// retVal.CouponFee = utils.MustInterface2Float64(value)
|
||||
// }
|
||||
// if value, ok := mapData["tips"]; ok {
|
||||
// retVal.CouponFee = utils.MustInterface2Float64(value)
|
||||
// }
|
||||
// if value, ok := mapData["insuranceFee"]; ok {
|
||||
// retVal.CouponFee = utils.MustInterface2Float64(value)
|
||||
// }
|
||||
// return retVal
|
||||
// }
|
||||
|
||||
func (a *API) operateOrder(action string, orderInfo *OperateOrderRequiredParams, addParams map[string]interface{}) (retVal *CreateOrderResponse, err error) {
|
||||
params := utils.Struct2MapByJson(orderInfo)
|
||||
params["callback"] = a.callbackURL
|
||||
allParams := utils.MergeMaps(params, addParams)
|
||||
result, err := a.AccessAPI(action, allParams)
|
||||
if err == nil {
|
||||
err = utils.Map2StructByJson(result.Result, &retVal, false)
|
||||
}
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func (a *API) operateOrder2(action string, orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
func (a *API) operateOrder(action string, orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
params := utils.Struct2MapByJson(orderInfo)
|
||||
params["callback"] = a.callbackURL
|
||||
result, err := a.AccessAPI(action, params)
|
||||
@@ -203,28 +149,16 @@ func (a *API) operateOrder2(action string, orderInfo *OperateOrderParams) (retVa
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
func (a *API) AddOrder(orderInfo *OperateOrderRequiredParams, addParams map[string]interface{}) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder("api/order/addOrder", orderInfo, addParams)
|
||||
func (a *API) AddOrder(orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder("api/order/addOrder", orderInfo)
|
||||
}
|
||||
|
||||
func (a *API) AddOrder2(orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder2("api/order/addOrder", orderInfo)
|
||||
func (a *API) ReaddOrder(orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder("api/order/reAddOrder", orderInfo)
|
||||
}
|
||||
|
||||
func (a *API) ReaddOrder(orderInfo *OperateOrderRequiredParams, addParams map[string]interface{}) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder("api/order/reAddOrder", orderInfo, addParams)
|
||||
}
|
||||
|
||||
func (a *API) ReaddOrder2(orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder2("api/order/reAddOrder", orderInfo)
|
||||
}
|
||||
|
||||
func (a *API) QueryDeliverFee(orderInfo *OperateOrderRequiredParams, addParams map[string]interface{}) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder("api/order/queryDeliverFee", orderInfo, addParams)
|
||||
}
|
||||
|
||||
func (a *API) QueryDeliverFee2(orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder2("api/order/queryDeliverFee", orderInfo)
|
||||
func (a *API) QueryDeliverFee(orderInfo *OperateOrderParams) (retVal *CreateOrderResponse, err error) {
|
||||
return a.operateOrder("api/order/queryDeliverFee", orderInfo)
|
||||
}
|
||||
|
||||
func (a *API) AddOrderAfterQuery(deliveryNo string) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user