- all call CallFuncLogError add order info

- callLegacyMsgHandler, callNewMsgHandler and generateLegacyJxOrder config
- call legacy lefted msg handler in new process(elm urge order and bad comment on jd)
This commit is contained in:
gazebo
2018-07-22 13:45:16 +08:00
parent dcdf432ac9
commit 0cb34fe089
14 changed files with 213 additions and 127 deletions

View File

@@ -26,15 +26,19 @@ func (c *DadaOrderController) URLMapping() {
func (c *DadaOrderController) OrderStatusChanged() {
obj, callbackResponse := api.DadaAPI.GetOrderCallbackMsg(c.Ctx.Input.RequestBody)
if callbackResponse == nil {
if globals.CallLegacy {
if globals.CallLegacyMsgHandler {
cc := &controller.OrderController{}
callbackResponse = cc.OrderStatusChanged(obj)
}
if globals.CallNew {
utils.CallFuncAsync(func() {
cc2 := &dada.WaybillController{}
cc2.OnWaybillMsg(obj)
})
if globals.CallNewMsgHandler {
cc2 := &dada.WaybillController{}
if globals.CallLegacyMsgHandler {
utils.CallFuncAsync(func() {
cc2.OnWaybillMsg(obj)
})
} else {
callbackResponse = cc2.OnWaybillMsg(obj)
}
}
}
if callbackResponse != nil && callbackResponse.Code != 200 {

View File

@@ -28,15 +28,19 @@ func (c *ELMOrderController) URLMapping() {
func (c *ELMOrderController) MsgPost() {
obj, callbackResponse := api.ElmAPI.GetCallbackMsg(c.Ctx.Input.RequestBody)
if callbackResponse == nil {
if globals.CallLegacy {
if globals.CallLegacyMsgHandler {
cc := &controller.OrderController{}
callbackResponse = cc.OrderMessage(obj)
}
if globals.CallNew {
utils.CallFuncAsync(func() {
cc2 := &elm.Controller{}
cc2.OnCallbackMsg(obj)
})
if globals.CallNewMsgHandler {
cc2 := &elm.Controller{}
if globals.CallLegacyMsgHandler {
utils.CallFuncAsync(func() {
cc2.OnCallbackMsg(obj)
})
} else {
callbackResponse = cc2.OnCallbackMsg(obj)
}
}
}
c.Data["json"] = callbackResponse

View File

@@ -37,15 +37,19 @@ func (c *JDOrderController) orderStatus(isCancelOrder bool) {
obj, callbackResponse = api.JdAPI.GetOrderCallbackMsg(c.Ctx.Input.RequestBody)
}
if callbackResponse == nil {
if globals.CallLegacy {
if globals.CallLegacyMsgHandler {
cc := controller.OrderController{}
callbackResponse = cc.OrderStatus(obj)
}
if globals.CallNew {
utils.CallFuncAsync(func() {
cc2 := &jd.OrderController{}
cc2.OnOrderMsg(obj)
})
if globals.CallNewMsgHandler {
cc2 := &jd.OrderController{}
if globals.CallLegacyMsgHandler {
utils.CallFuncAsync(func() {
cc2.OnOrderMsg(obj)
})
} else {
callbackResponse = cc2.OnOrderMsg(obj)
}
}
}
c.Data["json"] = callbackResponse
@@ -151,15 +155,19 @@ func (c *JDOrderController) ApplyCancelOrder() {
func (c *JDOrderController) PushDeliveryStatus() {
obj, callbackResponse := api.JdAPI.GetOrderDeliveryCallbackMsg(c.Ctx.Input.RequestBody)
if callbackResponse == nil {
if globals.CallLegacy {
if globals.CallLegacyMsgHandler {
cc := controller.OrderController{}
callbackResponse = cc.OrderDeliveryStatus(obj)
}
if globals.CallNew {
utils.CallFuncAsync(func() {
cc2 := &jd.WaybillController{}
cc2.OnWaybillMsg(obj)
})
if globals.CallNewMsgHandler {
cc2 := &jd.WaybillController{}
if globals.CallLegacyMsgHandler {
utils.CallFuncAsync(func() {
cc2.OnWaybillMsg(obj)
})
} else {
callbackResponse = cc2.OnWaybillMsg(obj)
}
}
}
c.Data["json"] = callbackResponse

View File

@@ -27,15 +27,19 @@ func (c *MTPSOrderController) URLMapping() {
func (c *MTPSOrderController) Status() {
obj, callbackResponse := api.MtpsAPI.GetOrderCallbackMsg(c.Ctx.Request)
if callbackResponse == nil {
if globals.CallLegacy {
if globals.CallLegacyMsgHandler {
cc := &controller.OrderController{}
callbackResponse = cc.OrderStatusChanged(obj)
}
if globals.CallNew {
utils.CallFuncAsync(func() {
cc2 := &mtps.WaybillController{}
cc2.OnWaybillMsg(obj)
})
if globals.CallNewMsgHandler {
cc2 := &mtps.WaybillController{}
if globals.CallLegacyMsgHandler {
utils.CallFuncAsync(func() {
cc2.OnWaybillMsg(obj)
})
} else {
callbackResponse = cc2.OnWaybillMsg(obj)
}
}
}
c.Data["json"] = callbackResponse
@@ -50,15 +54,19 @@ func (c *MTPSOrderController) Status() {
func (c *MTPSOrderController) Except() {
obj, callbackResponse := api.MtpsAPI.GetOrderExceptionCallbackMsg(c.Ctx.Request)
if callbackResponse == nil {
if globals.CallLegacy {
if globals.CallLegacyMsgHandler {
cc := &controller.OrderController{}
callbackResponse = cc.OrderException(obj)
}
if globals.CallNew {
utils.CallFuncAsync(func() {
cc2 := &mtps.WaybillController{}
cc2.OnWaybillExcept(obj)
})
if globals.CallNewMsgHandler {
cc2 := &mtps.WaybillController{}
if globals.CallLegacyMsgHandler {
utils.CallFuncAsync(func() {
cc2.OnWaybillExcept(obj)
})
} else {
callbackResponse = cc2.OnWaybillExcept(obj)
}
}
}
c.Data["json"] = callbackResponse