This commit is contained in:
suyl
2021-06-15 10:15:47 +08:00
parent b4688c4a77
commit c57d3dabb5
3 changed files with 32 additions and 34 deletions

View File

@@ -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

View File

@@ -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,6 +142,10 @@ 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.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
}
@@ -174,6 +177,7 @@ func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi.
}
}
}
}
return jdapi.SuccessResponse
}

View File

@@ -39,9 +39,7 @@ func (c *DjswController) orderStatus() {
if c.Ctx.Input.Method() == http.MethodPost {
globals.SugarLogger.Debugf("jd deliverOrder 1")
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {
globals.SugarLogger.Debugf("jd deliverOrder 2", utils.Format4Output(callbackResponse, false))
callbackResponse = jd.OnOrderMsg(obj.(*jdapi.CallbackOrderMsg), a)
globals.SugarLogger.Debugf("jd deliverOrder 3", utils.Format4Output(callbackResponse, false))
return callbackResponse
})
c.Data["json"] = c.transferResponse("orderStatus", callbackResponse)