diff --git a/business/partner/purchase/ebai/waybill.go b/business/partner/purchase/ebai/waybill.go index f145c1bc9..739799838 100644 --- a/business/partner/purchase/ebai/waybill.go +++ b/business/partner/purchase/ebai/waybill.go @@ -5,6 +5,7 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/partner" + "git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals/api" ) @@ -33,30 +34,30 @@ func (p *PurchaseHandler) GetWaybillStatusFromVendorStatus(vendorStatus string) func (c *PurchaseHandler) onWaybillMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaiapi.CallbackResponse) { order := c.callbackMsg2Waybill(msg) + globals.SugarLogger.Debugf("ebai onWaybillMsg orderID:%s", order.VendorOrderID) if order.Status == model.WaybillStatusAccepted { - if result, err := api.EbaiAPI.OrderGet(order.VendorOrderID); err != nil { + if result, err := api.EbaiAPI.OrderDeliveryGet(order.VendorOrderID); err != nil { + globals.SugarLogger.Warnf("ebai onWaybillMsg orderID:%s TestOrderDeliveryGet failed with error:%v", order.VendorOrderID, err) return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, err, order.VendorOrderID) } else { - order.CourierMobile = utils.Interface2String(result["order"].(map[string]interface{})["delivery_phone"]) + order.CourierName = utils.Interface2String(result["name"]) + order.CourierMobile = utils.Interface2String(result["phone"]) } } return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus) } 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"])) + vendorStatus := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["status"])) + orderID := GetOrderIDFromMsg(msg) retVal = &model.Waybill{ VendorOrderID: orderID, OrderVendorID: model.VendorIDEBAI, VendorWaybillID: orderID, WaybillVendorID: model.VendorIDEBAI, Status: c.GetWaybillStatusFromVendorStatus(vendorStatus), - CourierName: "", // 饿百取不到骑手的名字 - // CourierMobile: msg.Phone, - VendorStatus: vendorStatus, - StatusTime: utils.Timestamp2Time(msg.Timestamp), + VendorStatus: vendorStatus, + StatusTime: utils.Timestamp2Time(msg.Timestamp), } return retVal }