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