From fa42da1f251e407650ad001057a821639ec50a54 Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 15 Oct 2018 10:59:12 +0800 Subject: [PATCH] - ebai the format of order_id of some different msgs are different. --- business/partner/purchase/ebai/callback.go | 8 +++++++- business/partner/purchase/ebai/order.go | 5 +++-- business/partner/purchase/ebai/waybill.go | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/business/partner/purchase/ebai/callback.go b/business/partner/purchase/ebai/callback.go index f6c474169..0b8d4afc8 100644 --- a/business/partner/purchase/ebai/callback.go +++ b/business/partner/purchase/ebai/callback.go @@ -2,12 +2,18 @@ package ebai import ( "git.rosy.net.cn/baseapi/platformapi/ebaiapi" + "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/model" ) func OnCallbackMsg(msg *ebaiapi.CallbackMsg) (response *ebaiapi.CallbackResponse) { - orderID := msg.Body["order_id"].(string) + orderID := "" + if response.Cmd == ebaiapi.CmdOrderCreate { + orderID = msg.Body["order_id"].(string) + } else { + orderID = utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["order_id"])) + } jxutils.CallMsgHandler(func() { switch msg.Cmd { case ebaiapi.CmdOrderCreate, ebaiapi.CmdOrderStatus: diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index d48681261..df277d2bb 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -169,11 +169,12 @@ func (c *PurchaseHandler) onOrderNew(msg *ebaiapi.CallbackMsg) (response *ebaiap func (c *PurchaseHandler) callbackMsg2Status(msg *ebaiapi.CallbackMsg) *model.OrderStatus { body := msg.Body vendorStatus := utils.Int64ToStr(utils.MustInterface2Int64(body["status"])) + orderID := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["order_id"])) orderStatus := &model.OrderStatus{ - VendorOrderID: body["order_id"].(string), + VendorOrderID: orderID, VendorID: model.VendorIDEBAI, OrderType: model.OrderTypeOrder, - RefVendorOrderID: body["order_id"].(string), + RefVendorOrderID: orderID, RefVendorID: model.VendorIDEBAI, VendorStatus: vendorStatus, Status: c.GetStatusFromVendorStatus(vendorStatus), diff --git a/business/partner/purchase/ebai/waybill.go b/business/partner/purchase/ebai/waybill.go index dbf26f833..f145c1bc9 100644 --- a/business/partner/purchase/ebai/waybill.go +++ b/business/partner/purchase/ebai/waybill.go @@ -46,10 +46,11 @@ func (c *PurchaseHandler) onWaybillMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaiap func (c *PurchaseHandler) callbackMsg2Waybill(msg *ebaiapi.CallbackMsg) (retVal *model.Waybill) { body := msg.Body vendorStatus := utils.Int64ToStr(utils.MustInterface2Int64(body["status"])) + orderID := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["order_id"])) retVal = &model.Waybill{ - VendorOrderID: body["order_id"].(string), + VendorOrderID: orderID, OrderVendorID: model.VendorIDEBAI, - VendorWaybillID: body["order_id"].(string), + VendorWaybillID: orderID, WaybillVendorID: model.VendorIDEBAI, Status: c.GetWaybillStatusFromVendorStatus(vendorStatus), CourierName: "", // 饿百取不到骑手的名字