From 8a703e62dff5f7c854e27e2b437d86433e1737d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sat, 5 Mar 2022 15:02:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=BA=E5=88=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/mtpsapi/mtpsapi.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/platformapi/mtpsapi/mtpsapi.go b/platformapi/mtpsapi/mtpsapi.go index 4f525ebc..bb476520 100644 --- a/platformapi/mtpsapi/mtpsapi.go +++ b/platformapi/mtpsapi/mtpsapi.go @@ -294,7 +294,7 @@ func (a *API) result2OrderResponse(result *ResponseResult) (order *OrderResponse order.MtPeisongID = result.Data["mt_peisong_id"].(string) order.DeliveryID = utils.MustInterface2Int64(result.Data["delivery_id"]) order.OrderID = result.Data["order_id"].(string) - order.DeliveryFee = result.Data["delivery_fee"].(float64) + order.DeliveryFee = utils.MustInterface2Float64(result.Data["delivery_fee"]) return order } @@ -447,14 +447,17 @@ type PreCreateByShopParam struct { InvoiceTitle string `json:"invoice_title,omitempty"` } -// 预发单 -func (a *API) PreCreateByShop(basicParams *PreCreateByShopParam) (lng, lat int, err error) { +// 美团预发单 +func (a *API) PreCreateByShop(basicParams *PreCreateByShopParam) (deliveryFee, baseDeliveryFee int, err error) { params := utils.Struct2MapByJson(basicParams) - _, err = a.AccessAPI("order/preCreateByShop", params) + result, err := a.AccessAPI("order/preCreateByShop", params) if err == nil { - + return 0, 0, err } - return lng, lat, err + + deliveryFee = utils.Float64TwoInt(result.Data["delivery_fee"].(float64) * 100) // 订单配送价格 + baseDeliveryFee = utils.Float64TwoInt(result.Data["base_delivery_fee"].(float64) * 100) // 订单优惠价格 + return deliveryFee, baseDeliveryFee, nil } // 预发单