From c5ef17afeee2fc1328ed22d5bdfa8773ca47f303 Mon Sep 17 00:00:00 2001 From: renyutian Date: Tue, 9 Apr 2019 13:58:09 +0800 Subject: [PATCH] =?UTF-8?q?ebai=20"delivery=5Fparty"=20=E5=A4=9A=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/financial.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/business/partner/purchase/ebai/financial.go b/business/partner/purchase/ebai/financial.go index 9df25065a..4a5bd94e8 100644 --- a/business/partner/purchase/ebai/financial.go +++ b/business/partner/purchase/ebai/financial.go @@ -160,7 +160,8 @@ func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) ( // orderFinancial.DeliveryConfirmTime = getTimeFromInterface(order1["finished_time"]) orderFinancial.TotalDiscountMoney = utils.MustInterface2Int64(order1["discount_fee"]) orderFinancial.ReceivableFreight = utils.MustInterface2Int64(order1["send_fee"]) - if int(utils.MustInterface2Int64(order1["delivery_party"])) == ebaiapi.SendImmediatelySelf { + + if int(getInt64FromInterface(order1["delivery_party"])) == ebaiapi.SendImmediatelySelf { orderFinancial.SelfDeliveryDiscountMoney = orderFinancial.ReceivableFreight orderFinancial.DistanceFreightMoney = 0 // 通过本地数据库去取是否转美团/达达,并计算运费 @@ -241,3 +242,13 @@ func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) ( orderFinancial.FreightDiscountMoney = orderFinancial.TotalDiscountMoney - orderFinancial.DiscountMoney return orderFinancial } + +func getInt64FromInterface(strOrNum interface{}) int64 { + var resultNum int64 + if resultStr, ok := strOrNum.(string); ok { + resultNum = utils.Str2Int64WithDefault(resultStr, 0) + } else { + resultNum = utils.Interface2Int64WithDefault(strOrNum, 0) + } + return resultNum +}