41 lines
916 B
Go
41 lines
916 B
Go
package controllers
|
|
|
|
import (
|
|
"bytes"
|
|
"io/ioutil"
|
|
"net/http"
|
|
|
|
"git.rosy.net.cn/jx-callback/business/jxstore/financial"
|
|
|
|
"git.rosy.net.cn/jx-callback/globals/api"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
|
|
"github.com/astaxie/beego"
|
|
"github.com/astaxie/beego/context"
|
|
)
|
|
|
|
type TongLianController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
func (c *TongLianController) Msg() {
|
|
if c.Ctx.Input.Method() == http.MethodPost {
|
|
call, err := api.TLpayAPI.GetCallbackMsg(getUsefulRequest2(c.Ctx))
|
|
globals.SugarLogger.Debugf("tonglianapi callback callbackResponse:%s", utils.Format4Output(call, true))
|
|
if err == nil {
|
|
err = financial.OnTLPayCallback(call)
|
|
}
|
|
c.Data["json"] = call
|
|
c.ServeJSON()
|
|
} else {
|
|
c.Abort("404")
|
|
}
|
|
}
|
|
|
|
func getUsefulRequest2(ctx *context.Context) *http.Request {
|
|
ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(ctx.Input.RequestBody))
|
|
return ctx.Request
|
|
}
|