From e3b33f0c3dac1d45f2cf8877002978c7f2d4d672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 1 Jul 2020 08:50:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E7=94=A8=E6=88=B7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AE=A2=E5=8D=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/weixinmsg/weixinmsg.go | 29 ++++++++++--------------- business/partner/purchase/jd/order.go | 16 ++++++++------ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index 689a14774..b2c26d880 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -332,44 +332,39 @@ func NotifyUserApplyCancel(order *model.GoodsOrder, cancelReason string) (err er } func NotifyOrderChanged(order *model.GoodsOrder) (err error) { - globals.SugarLogger.Debugf("NotifyOrderCanceled orderID:%s", order.VendorOrderID) + globals.SugarLogger.Debugf("NotifyOrderChanged orderID:%s", order.VendorOrderID) if order.VendorID == model.VendorIDELM { return nil } - - if !model.IsOrderSolid(order) { - globals.SugarLogger.Infof("NotifyOrderCanceled orderID:%s is not solid", order.VendorOrderID) - return nil - } - title := fmt.Sprintf("老板,您的订单%s第%d号订单, %s被取消了!", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID) + title := fmt.Sprintf("您有订单的信息已被修改") data := map[string]interface{}{ "first": map[string]interface{}{ "value": title, "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderProductPrice": map[string]interface{}{ - "value": jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), + "keyword1": map[string]interface{}{ + "value": order.VendorOrderID, "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderProductName": map[string]interface{}{ - "value": getOrderDetailBrief(order), + "keyword2": map[string]interface{}{ + "value": "用户修改订单", "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderAddress": map[string]interface{}{ - "value": order.ConsigneeAddress, + "keyword3": map[string]interface{}{ + "value": order.ConsigneeAddress + "," + order.ConsigneeName + "," + order.ConsigneeMobile, "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, - "orderName": map[string]interface{}{ - "value": fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, order.VendorOrderID), + "keyword4": map[string]interface{}{ + "value": utils.Time2Str(order.OrderCreatedAt), "color": VendorColors[order.VendorID], }, "remark": map[string]interface{}{ - "value": order.ConsigneeMobile, + "value": "请及时处理", "color": WX_NEW_ORDER_TEMPLATE_COLOR, }, } storeID := jxutils.GetSaleStoreIDFromOrder(order) - err = SendMsgToStore(storeID, WX_ORDER_ORDER_CANCELED_TEMPLATE_ID, "", "", data) + err = SendMsgToStore(storeID, WX_ORDER_CHANGE_INFO_TEMPLATE_ID, "", "", data) netprinter.NofityOrderMsg(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, title) return err } diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index a11e0ef08..8c55f37cf 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg" + "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" @@ -129,9 +131,9 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi. globals.SugarLogger.Debugf("onOrderInfoChangeMsg orderID:%s", msg.BillID) orderInfoChangeSet(order, msg) globals.SugarLogger.Debugf("onOrderInfoChangeMsg2: %v", order) - // db := dao.GetDB() - // _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") - // weixinmsg.NotifyOrderChanged(order) + db := dao.GetDB() + _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") + weixinmsg.NotifyOrderChanged(order) // partner.CurOrderManager.ChangeOrderInfo(order) } return retVal @@ -588,11 +590,11 @@ func orderInfoChangeSet(order *model.GoodsOrder, msg *jdapi.CallbackOrderInfoCha if msg.BuyerMobile != "" { order.ConsigneeMobile = msg.BuyerMobile } - if msg.BuyerLat != 0 { - order.ConsigneeLat = jxutils.StandardCoordinate2Int(msg.BuyerLat) + if msg.BuyerLat != "" { + order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat)) } - if msg.BuyerLng != 0 { - order.ConsigneeLng = jxutils.StandardCoordinate2Int(msg.BuyerLng) + if msg.BuyerLng != "" { + order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng)) } if msg.OrderBuyerRemark != "" { order.BuyerComment = msg.OrderBuyerRemark