aa
This commit is contained in:
@@ -2,14 +2,10 @@ package jd
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
func OnOrderMsg(msg *jdapi.CallbackOrderMsg, a *jdapi.API) (retVal *jdapi.CallbackResponse) {
|
||||
globals.SugarLogger.Debugf("jd deliverOrder 3.5 %v", utils.Format4Output(CurPurchaseHandler, true))
|
||||
if CurPurchaseHandler != nil {
|
||||
globals.SugarLogger.Debugf("jd deliverOrder 3.6 %v", utils.Format4Output(msg, true))
|
||||
retVal = CurPurchaseHandler.OnOrderMsg(a, msg)
|
||||
}
|
||||
return retVal
|
||||
|
||||
@@ -63,7 +63,6 @@ func (c *PurchaseHandler) OnOrderMsg(a *jdapi.API, msg *jdapi.CallbackOrderMsg)
|
||||
primaryID := msg.BillID
|
||||
primaryID += utils.Int64ToStr(time.Now().Unix())
|
||||
jxutils.CallMsgHandler(func() {
|
||||
globals.SugarLogger.Debugf("jd deliverOrder 3.7 ")
|
||||
retVal = c.onOrderMsg(a, msg)
|
||||
}, primaryID)
|
||||
return retVal
|
||||
@@ -143,33 +142,38 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi.
|
||||
order, err := dao.GetSimpleOrder(db, msg.BillID)
|
||||
if err == nil {
|
||||
globals.SugarLogger.Debugf("onOrderInfoChangeMsg msg:%v", utils.Format4Output(msg, false))
|
||||
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 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user