From f20bc5b5b28f3f059aa381178256681c1e6e132b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 2 Mar 2020 11:51:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=81=94=E5=AE=9D=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/tonglian_callback.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/controllers/tonglian_callback.go b/controllers/tonglian_callback.go index 95ad531ad..6d33cb8c2 100644 --- a/controllers/tonglian_callback.go +++ b/controllers/tonglian_callback.go @@ -1,6 +1,8 @@ package controllers import ( + "bytes" + "io/ioutil" "net/http" "git.rosy.net.cn/jx-callback/globals/api" @@ -10,6 +12,7 @@ import ( "git.rosy.net.cn/jx-callback/globals" "github.com/astaxie/beego" + "github.com/astaxie/beego/context" ) type TongLianController struct { @@ -18,7 +21,7 @@ type TongLianController struct { func (c *TongLianController) Msg() { if c.Ctx.Input.Method() == http.MethodPost { - call, err := api.TLpayAPI.GetCallbackMsg(c.Ctx.Request) + call, err := api.TLpayAPI.GetCallbackMsg(getUsefulRequest2(c.Ctx)) globals.SugarLogger.Debugf("tonglianapi callback callbackResponse:%s", utils.Format4Output(call, true)) if err == nil { err = localjx.OnTLPayCallback(call) @@ -29,3 +32,8 @@ func (c *TongLianController) Msg() { c.Abort("404") } } + +func getUsefulRequest2(ctx *context.Context) *http.Request { + ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(ctx.Input.RequestBody)) + return ctx.Request +}