From bed22236009c0d6150f8f964078f472e1b4bca50 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 29 Oct 2019 17:54:15 +0800 Subject: [PATCH] =?UTF-8?q?OrderManager.OnOrderStatusChanged=E4=B8=AD=20?= =?UTF-8?q?=E6=9C=89=E4=BA=9B=E5=B9=B3=E5=8F=B0=EF=BC=88=E6=AF=94=E5=A6=82?= =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E5=A4=96=E5=8D=96=EF=BC=89=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E6=96=B0=E8=AE=A2=E5=8D=95=E4=BA=8B=E4=BB=B6=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=94=E5=9B=9E=EF=BC=8C=E4=BD=86=E5=9C=A8?= =?UTF-8?q?=E9=87=8D=E5=8F=91=E8=AE=A2=E5=8D=95=E6=B6=88=E6=81=AF=E5=89=8D?= =?UTF-8?q?=EF=BC=8C=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E4=B8=8D=E4=BC=9A=E5=86=8D=E9=87=8D=E5=8F=91?= =?UTF-8?q?=E6=96=B0=E8=AE=A2=E5=8D=95=E4=BA=8B=E4=BB=B6=EF=BC=8C=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=A4=84=E7=90=86=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index b9dcf5fd7..b1c52f003 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -11,6 +11,7 @@ import ( "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" + "git.rosy.net.cn/jx-callback/business/partner" "git.rosy.net.cn/jx-callback/globals" "github.com/astaxie/beego/orm" ) @@ -151,6 +152,17 @@ func (c *OrderManager) OnOrderAdjust(order *model.GoodsOrder, orderStatus *model } func (c *OrderManager) OnOrderStatusChanged(orderStatus *model.OrderStatus) (err error) { + // 有些平台(比如美团外卖),在新订单事件没有成功返回,但在重发订单消息前,订单状态转换,则不会再重发新订单事件,特殊处理一下 + if orderStatus.Status == model.OrderStatusAccepted { + if _, err2 := c.LoadOrder(orderStatus.VendorOrderID, orderStatus.VendorID); err2 == ErrCanNotFindOrder { + if handler := partner.GetPurchaseOrderHandlerFromVendorID(orderStatus.VendorID); handler != nil { + if order, err2 := handler.GetOrder(orderStatus.VendorOrderID); err2 == nil { + c.OnOrderNew(order, orderStatus) + } + } + } + } + db := dao.GetDB() dao.Begin(db) defer func() {