58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package controllers
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/platformapi/elmapi"
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/business/partner/purchase/elm"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
"git.rosy.net.cn/jx-callback/globals/api"
|
|
"git.rosy.net.cn/jx-callback/legacy/elm/controller"
|
|
"github.com/astaxie/beego"
|
|
)
|
|
|
|
// Operations about ELMOrder
|
|
type ELMOrderController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
func (c *ELMOrderController) URLMapping() {
|
|
c.Mapping("MsgPost", c.MsgPost)
|
|
c.Mapping("MsgGet", c.MsgGet)
|
|
}
|
|
|
|
// @Title all msg
|
|
// @Description create object
|
|
// @Success 200 {string} models.Object.Id
|
|
// @Failure 403 body is empty
|
|
// @router /msg [post]
|
|
func (c *ELMOrderController) MsgPost() {
|
|
obj, callbackResponse := api.ElmAPI.GetCallbackMsg(c.Ctx.Input.RequestBody)
|
|
if callbackResponse == nil {
|
|
if globals.CallLegacyMsgHandler {
|
|
cc := &controller.OrderController{}
|
|
callbackResponse = cc.OrderMessage(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
|
|
c.ServeJSON()
|
|
}
|
|
|
|
// @Title all msg test
|
|
// @Description create object
|
|
// @Success 200 {string} models.Object.Id
|
|
// @router /msg [get]
|
|
func (c *ELMOrderController) MsgGet() {
|
|
c.Data["json"] = elmapi.SuccessResponse
|
|
c.ServeJSON()
|
|
}
|