This commit is contained in:
suyl
2021-06-21 09:08:13 +08:00
parent cf0a41ff80
commit 0de165f792
2 changed files with 27 additions and 31 deletions

View File

@@ -143,36 +143,32 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi.
if err == nil { if err == nil {
globals.SugarLogger.Debugf("onOrderInfoChangeMsg msg:%v", utils.Format4Output(msg, false)) globals.SugarLogger.Debugf("onOrderInfoChangeMsg msg:%v", utils.Format4Output(msg, false))
//任意一项变了 //任意一项变了
if msg.BuyerFullAddress != order.ConsigneeAddress || msg.BuyerFullName != order.ConsigneeName || msg.BuyerMobile != order.ConsigneeMobile || if order.AdjustCount < 3 {
jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat)) != order.ConsigneeLat || jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng)) != order.ConsigneeLng || if msg.BuyerFullAddress != order.ConsigneeAddress || msg.BuyerFullName != order.ConsigneeName || msg.BuyerMobile != order.ConsigneeMobile ||
msg.OrderBuyerRemark != order.BuyerComment { jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat)) != order.ConsigneeLat || jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng)) != order.ConsigneeLng ||
if msg.BuyerFullAddress != "" { msg.OrderBuyerRemark != order.BuyerComment {
order.ConsigneeAddress = msg.BuyerFullAddress if order.Status <= model.OrderStatusDelivering {
} if err = weixinmsg.NotifyOrderChanged(order); err == nil {
if msg.BuyerFullName != "" { if msg.BuyerFullAddress != "" {
order.ConsigneeName = msg.BuyerFullName order.ConsigneeAddress = msg.BuyerFullAddress
} }
if msg.BuyerMobile != "" { if msg.BuyerFullName != "" {
order.ConsigneeMobile = msg.BuyerMobile order.ConsigneeName = msg.BuyerFullName
} }
if msg.BuyerLat != "" { if msg.BuyerMobile != "" {
order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat)) order.ConsigneeMobile = msg.BuyerMobile
} }
if msg.BuyerLng != "" { if msg.BuyerLat != "" {
order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng)) order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat))
} }
if msg.OrderBuyerRemark != "" { if msg.BuyerLng != "" {
order.BuyerComment = msg.OrderBuyerRemark order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng))
} }
_, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment") if msg.OrderBuyerRemark != "" {
if order.Status <= model.OrderStatusEndBegin { order.BuyerComment = msg.OrderBuyerRemark
if order.BusinessType == model.BusinessTypeImmediate { }
if time.Now().Sub(order.OrderCreatedAt).Hours() <= 1 { order.AdjustCount++
weixinmsg.NotifyOrderChanged(order) _, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment", "AdjustCount")
}
} else {
if order.ExpectedDeliveredTime.Sub(time.Now()).Hours() >= 1 {
weixinmsg.NotifyOrderChanged(order)
} }
} }
} }