32 lines
955 B
Go
32 lines
955 B
Go
package controllers
|
|
|
|
import (
|
|
"bytes"
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-print/globals"
|
|
"git.rosy.net.cn/jx-print/model"
|
|
"git.rosy.net.cn/jx-print/services/api"
|
|
"git.rosy.net.cn/jx-print/services/print_server"
|
|
"github.com/gin-gonic/gin"
|
|
"io/ioutil"
|
|
)
|
|
|
|
type CallbackController struct {
|
|
}
|
|
|
|
func (t *CallbackController) Msg(c *gin.Context) {
|
|
data, _ := ioutil.ReadAll(c.Request.Body)
|
|
globals.SugarLogger.Debugf("callback msg : %v , user-agent :%s", string(data), c.Request.UserAgent())
|
|
c.JSON(200, &model.CallBack{})
|
|
}
|
|
|
|
func (t *CallbackController) TlPayCallback(c *gin.Context) {
|
|
data, _ := ioutil.ReadAll(c.Request.Body)
|
|
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(data))
|
|
if call, err := api.TLpayAPI.GetCallbackMsg(c.Request); err == nil {
|
|
globals.SugarLogger.Debugf("tonglianapi callback callbackResponse:%s", utils.Format4Output(call, true))
|
|
print_server.PayTLCallback(call)
|
|
}
|
|
c.JSON(200, &model.CallBack{})
|
|
}
|