- mtps added.
- refactor.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platform/elmapi"
|
||||
"git.rosy.net.cn/jx-callback/business/elm/controller"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
@@ -25,17 +23,12 @@ func (c *ELMOrderController) URLMapping() {
|
||||
// @Failure 403 body is empty
|
||||
// @router /msg [post]
|
||||
func (c *ELMOrderController) MsgPost() {
|
||||
var obj elmapi.ELMCallbackMsg
|
||||
jdParamJSON := c.Ctx.Input.RequestBody
|
||||
|
||||
err := json.Unmarshal([]byte(jdParamJSON), &obj)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Warnf("error when Unmarshal data:%v, error:%v", jdParamJSON, err)
|
||||
c.Data["json"] = elmapi.ELMCallbackResponse{Message: "failed"}
|
||||
} else {
|
||||
obj, callbackResponse := globals.ElmAPI.GetMsgFromData(c.Ctx.Input.RequestBody)
|
||||
if callbackResponse == nil {
|
||||
cc := &controller.OrderController{}
|
||||
c.Data["json"] = cc.OrderMessage(&obj)
|
||||
c.Data["json"] = cc.OrderMessage(obj)
|
||||
}
|
||||
c.Data["json"] = callbackResponse
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -44,6 +37,6 @@ func (c *ELMOrderController) MsgPost() {
|
||||
// @Success 200 {string} models.Object.Id
|
||||
// @router /msg [get]
|
||||
func (c *ELMOrderController) MsgGet() {
|
||||
c.Data["json"] = elmapi.ELMResponseOK
|
||||
c.Data["json"] = elmapi.SuccessResponse
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user