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

@@ -1438,7 +1438,7 @@ func GetMatterStoreOrderCount(ctx *jxcontext.Context, storeID int) (result *Orde
AND a.from_store_id = ?
AND a.status >= ? AND a.status <> ?
AND b.status = ?
ORDER BY b.pay_finished_at DESC
ORDER BY b.pay_finished_at DESC
LIMIT 1
`
sqlParams := []interface{}{storeID, model.OrderStatusDelivering, model.OrderStatusCanceled, model.PayStatusYes}

View File

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