package controllers import ( "net/http" "github.com/astaxie/beego" ) type TongLianController struct { beego.Controller } func (c *TongLianController) Msg() { if c.Ctx.Input.Method() == http.MethodPost { // msg, callbackResponse := api.TLpayAPI.GetCallbackMsg(c.Ctx.Request) // globals.SugarLogger.Debugf("tonglianapi callback msg:%s, callbackResponse:%s, %t", utils.Format4Output(msg, true), utils.Format4Output(callbackResponse, true), callbackResponse == nil) // var err error // if callbackResponse == nil { // if msg.MsgType == wxpayapi.MsgTypeUnkown { // err = fmt.Errorf("未知的通联宝支付回调类型:%d", msg.MsgType) // } else { // err = localjx.OnTLPayCallback(msg) // } // } // if callbackResponse == nil { // callbackResponse = wxpayapi.SuccessResponse // } else if err != nil { // callbackResponse = wxpayapi.Err2CallbackResponse(err, "") // } // c.Data["json"] = callbackResponse // c.ServeJSON() } else { c.Abort("404") } }