This commit is contained in:
邹宗楠
2026-05-13 09:48:45 +08:00
parent d6e91fa125
commit 8ea9f38a99

View File

@@ -2,10 +2,8 @@ package controllers
import (
"bytes"
"io/ioutil"
"net/http"
"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"
@@ -15,17 +13,30 @@ 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() {
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")
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()
}