From 3f459a5e10fc8db94a33edcb5d361b42d763aec2 Mon Sep 17 00:00:00 2001 From: gazebo Date: Sat, 21 Sep 2019 17:01:41 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E9=98=B2=E6=AD=A2=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=8F=91=E9=80=81=E8=AE=A2=E5=8D=95=E5=8F=96=E6=B6=88=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/scheduler/defsch/defsch.go | 7 ++++--- business/jxstore/cms/sku.go | 5 ++--- business/jxutils/weixinmsg/weixinmsg.go | 8 ++++++-- business/partner/purchase/mtwm/order.go | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 6218d8d99..55018bdb7 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -325,7 +325,8 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod } else if order.Status > model.OrderStatusUnknown && status.Status > model.OrderStatusUnknown && order.Status != status.Status { globals.SugarLogger.Warnf("OnOrderStatusChanged strange order:%s, status:%s", utils.Format4Output(order, true), utils.Format4Output(status, true)) } - savedOrderInfo := s.loadSavedOrderFromMap(status, false) + savedOrderInfo := s.loadSavedOrderFromMap(status, false) // 可能会有重复的消息(比如订单取消) + statusChanged := savedOrderInfo.order == nil || savedOrderInfo.order.Status != order.Status savedOrderInfo.SetOrder(order) if (model.IsOrderUnlockStatus(status.Status)) || @@ -366,7 +367,7 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod } if !isPending { if status.Status == model.OrderStatusFinishedPickup || status.Status == model.OrderStatusCanceled { - if status.Status == model.OrderStatusCanceled { + if statusChanged && status.Status == model.OrderStatusCanceled { s.notifyOrderCanceled(savedOrderInfo.order) } msghub.OnFinishedPickup(savedOrderInfo.order) @@ -374,7 +375,7 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod status.Status == model.OrderStatusApplyFailedGetGoods || //model.IsOrderUnlockStatus(status.Status) || status.Status == model.OrderStatusAgreeFailedGetGoods || status.Status == model.OrderStatusDeliverFailed { - if status.Status == model.OrderStatusApplyCancel { + if statusChanged && status.Status == model.OrderStatusApplyCancel { s.notifyUserApplyCancel(savedOrderInfo.order, status.Remark) } msghub.OnKeyOrderStatusChanged(savedOrderInfo.order) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index acc3403e9..ab30626b8 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -471,9 +471,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma ORDER BY MIN(t2.seq), t1.id DESC LIMIT ? OFFSET ?` pageSize = jxutils.FormalizePageSize(pageSize) - if offset < 0 { - offset = 0 - } + offset = jxutils.FormalizePageOffset(offset) + sqlParams = append(sqlParams, pageSize, offset) skuNamesInfo = &SkuNamesInfo{} dao.Begin(db) // todo 这里用事务的原因是,SQL_CALC_FOUND_ROWS会出错 diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index 736035d82..8a6ceb805 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -330,7 +330,7 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er }, "keyword1": map[string]interface{}{ // 订单编号 "value": fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID), - "color": WX_NEW_ORDER_TEMPLATE_COLOR, + "color": venderColors[order.VendorID], }, "keyword2": map[string]interface{}{ // 订单日期 "value": utils.Time2Str(order.OrderCreatedAt), @@ -338,7 +338,7 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er }, "keyword3": map[string]interface{}{ // 订单内容 "value": cancelReason, - "color": venderColors[order.VendorID], + "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, "remark": map[string]interface{}{ "value": order.ConsigneeMobile, @@ -377,6 +377,10 @@ func NotifyOrderCanceled(order *model.GoodsOrder) (err error) { }, "orderAddress": map[string]interface{}{ "value": order.ConsigneeAddress, + "color": WX_NEW_ORDER_TEMPLATE_COLOR, + }, + "orderName": map[string]interface{}{ + "value": fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID), "color": venderColors[order.VendorID], }, "remark": map[string]interface{}{ diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 358b9871a..983e04127 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -365,7 +365,7 @@ func (c *PurchaseHandler) callbackMsg2Status(msg *mtwmapi.CallbackMsg) (orderSta } else if notifyType == mtwmapi.NotifyTypeReject { vendorStatus = fakeRefuseUserApplyCancel } else if notifyType == mtwmapi.NotifyTypeSuccess { - vendorStatus = fakeMerchantAgreeApplyCancel + vendorStatus = fakeMerchantAgreeApplyCancel // todo 可能导致订单取消消息重复 } } }