75 lines
1.9 KiB
Go
75 lines
1.9 KiB
Go
package controllers
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/business/partner/delivery/mtps"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
"git.rosy.net.cn/jx-callback/globals/api"
|
|
"git.rosy.net.cn/jx-callback/legacy/mtps/controller"
|
|
"github.com/astaxie/beego"
|
|
)
|
|
|
|
// Operations about ELMOrder
|
|
type MTPSOrderController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
func (c *MTPSOrderController) URLMapping() {
|
|
c.Mapping("Status", c.Status)
|
|
c.Mapping("Except", c.Except)
|
|
}
|
|
|
|
// @Title all msg
|
|
// @Description create object
|
|
// @Success 200 {string} models.Object.Id
|
|
// @Failure 403 body is empty
|
|
// @router /status [post]
|
|
func (c *MTPSOrderController) Status() {
|
|
obj, callbackResponse := api.MtpsAPI.GetOrderCallbackMsg(c.Ctx.Request)
|
|
if callbackResponse == nil {
|
|
if globals.CallLegacyMsgHandler {
|
|
cc := &controller.OrderController{}
|
|
callbackResponse = cc.OrderStatusChanged(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
|
|
c.ServeJSON()
|
|
}
|
|
|
|
// @Title all msg test
|
|
// @Description create object
|
|
// @Success 200 {string} models.Object.Id
|
|
// @Failure 403 body is empty
|
|
// @router /except [Post]
|
|
func (c *MTPSOrderController) Except() {
|
|
obj, callbackResponse := api.MtpsAPI.GetOrderExceptionCallbackMsg(c.Ctx.Request)
|
|
if callbackResponse == nil {
|
|
if globals.CallLegacyMsgHandler {
|
|
cc := &controller.OrderController{}
|
|
callbackResponse = cc.OrderException(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
|
|
c.ServeJSON()
|
|
}
|