35 lines
775 B
Go
35 lines
775 B
Go
package controllers
|
|
|
|
import (
|
|
"bytes"
|
|
"io/ioutil"
|
|
"net/http"
|
|
|
|
"git.rosy.net.cn/jx-callback/business/partner/purchase/jdshop"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
"git.rosy.net.cn/jx-callback/globals/api"
|
|
"github.com/astaxie/beego"
|
|
)
|
|
|
|
type JdsController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
func (c *JdsController) Msg() {
|
|
if c.Ctx.Input.Method() == http.MethodPost {
|
|
ctx := c.Ctx
|
|
ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(ctx.Input.RequestBody))
|
|
call, err := api.JdShopAPI.GetCallbackMsg(ctx.Request)
|
|
if err == nil {
|
|
jdshop.OnCallbackMsg(call)
|
|
}
|
|
globals.SugarLogger.Debugf("jds callback callbackResponse:%s", utils.Format4Output(call, true))
|
|
c.Data["json"] = call
|
|
c.ServeJSON()
|
|
} else {
|
|
c.Abort("404")
|
|
}
|
|
}
|