- elm callback basic.

This commit is contained in:
gazebo
2018-06-14 17:50:58 +08:00
parent 4854395ef3
commit ad1a6ab5c4
12 changed files with 273 additions and 48 deletions

40
controllers/elm_order.go Normal file
View File

@@ -0,0 +1,40 @@
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"
"github.com/astaxie/beego"
)
// Operations about ELMOrder
type ELMOrderController struct {
beego.Controller
}
func (c *ELMOrderController) URLMapping() {
c.Mapping("Msg", c.Msg)
}
// @Title all msg
// @Description create object
// @Param jd_param_json formData string true "应用级别输入参数"
// @Success 200 {string} models.Object.Id
// @Failure 403 body is empty
// @router /msg [post]
func (c *ELMOrderController) Msg() {
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 {
cc := &controller.OrderController{}
c.Data["json"] = cc.OrderMessage(&obj)
}
c.ServeJSON()
}

View File

@@ -43,7 +43,7 @@ func (c *JDOrderController) handleJDCallback(obj interface{}, needUnescape bool,
func (c *JDOrderController) orderStatus() {
var ob jdapi.JDOrderMsg
c.handleJDCallback(&ob, false, func() interface{} {
cc := controller.OrderControler{}
cc := controller.OrderController{}
return cc.OrderStatus(&ob)
})
}
@@ -147,7 +147,7 @@ func (c *JDOrderController) ApplyCancelOrder() {
func (c *JDOrderController) PushDeliveryStatus() {
var ob jdapi.JDDeliveryStatusMsg
c.handleJDCallback(&ob, true, func() interface{} {
cc := controller.OrderControler{}
cc := controller.OrderController{}
return cc.OrderDeliveryStatus(&ob)
})
}