50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package controllers
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/business/partner/delivery/dada"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
"git.rosy.net.cn/jx-callback/globals/api"
|
|
"git.rosy.net.cn/jx-callback/legacy/dada/controller"
|
|
"github.com/astaxie/beego"
|
|
)
|
|
|
|
// Operations about ELMOrder
|
|
type DadaOrderController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
func (c *DadaOrderController) URLMapping() {
|
|
c.Mapping("OrderStatusChanged", c.OrderStatusChanged)
|
|
}
|
|
|
|
// @Title all msg
|
|
// @Description create object
|
|
// @Success 200 {string} models.Object.Id
|
|
// @Failure 403 body is empty
|
|
// @router /msg [post]
|
|
func (c *DadaOrderController) OrderStatusChanged() {
|
|
obj, callbackResponse := api.DadaAPI.GetOrderCallbackMsg(c.Ctx.Input.RequestBody)
|
|
if callbackResponse == nil {
|
|
if globals.CallLegacyMsgHandler {
|
|
cc := &controller.OrderController{}
|
|
callbackResponse = cc.OrderStatusChanged(obj)
|
|
}
|
|
if globals.CallNewMsgHandler {
|
|
if globals.CallLegacyMsgHandler {
|
|
utils.CallFuncAsync(func() {
|
|
dada.OnWaybillMsg(obj)
|
|
})
|
|
} else {
|
|
callbackResponse = dada.OnWaybillMsg(obj)
|
|
}
|
|
}
|
|
}
|
|
if callbackResponse != nil && callbackResponse.Code != 200 {
|
|
c.CustomAbort(callbackResponse.Code, string(utils.MustMarshal(callbackResponse)))
|
|
} else {
|
|
c.Data["json"] = callbackResponse
|
|
c.ServeJSON()
|
|
}
|
|
}
|