Files
jx-callback/controllers/elm_order.go
苏尹岚 ac2bb2bcfe aa
2021-03-30 10:19:36 +08:00

32 lines
918 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package controllers
import (
"net/http"
"git.rosy.net.cn/baseapi/platformapi/elmapi"
beego "github.com/astaxie/beego/adapter"
)
// Operations about ELMOrder
type ElemeController struct {
beego.Controller
}
// https://open.shop.ele.me/openapi/documents/httppushmethod
func (c *ElemeController) Msg() {
if c.Ctx.Input.Method() == http.MethodPost {
callbackResponse := elmapi.SuccessResponse
// obj, callbackResponse := api.ElmAPI.GetCallbackMsg(c.Ctx.Input.RequestBody)
// if callbackResponse == nil {
// callbackResponse = elm.OnCallbackMsg(obj)
// }
c.Data["json"] = callbackResponse
c.ServeJSON()
} else if c.Ctx.Input.Method() == http.MethodGet { // 应用需要支持推送地址的GET访问当GET请求访问时请直接返回{“message”:“ok”},用于推送地址的可用性测试。
c.Data["json"] = elmapi.SuccessResponse
c.ServeJSON()
} else {
c.Abort("404")
}
}