This commit is contained in:
邹宗楠
2026-05-14 14:06:13 +08:00
parent 8ea9f38a99
commit d72db7588f
2 changed files with 110 additions and 86 deletions

View File

@@ -3,40 +3,28 @@ package controllers
import (
"bytes"
"git.rosy.net.cn/jx-callback/business/partner/purchase/jdshop"
"io/ioutil"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web"
"io/ioutil"
"net/http"
)
type JdsController struct {
web.Controller
}
// Msg 这个是京东秒送平台回调
//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)
// }
// c.Data["json"] = call
// c.ServeJSON()
// } else {
// c.Abort("404")
// }
//}
// Msg 这个是京东秒送平台回调
func (c *JdsController) Msg() {
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)
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)
}
c.Data["json"] = call
c.ServeJSON()
} else {
c.Abort("404")
}
c.Data["json"] = call
c.ServeJSON()
}