订单配送,打印机

This commit is contained in:
邹宗楠
2022-06-01 15:36:08 +08:00
parent 1eae9e6ba4
commit b5a0ab5757
6 changed files with 100 additions and 30 deletions

View File

@@ -0,0 +1,41 @@
package controllers
import (
"fmt"
"net/http"
"git.rosy.net.cn/baseapi/platformapi/wxpayapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web"
)
type TTPayController struct {
web.Controller
}
func (c *TTPayController) Msg() {
if c.Ctx.Input.Method() == http.MethodPost {
msg, callbackResponse := api.WxpayAPI.GetCallbackMsg(c.Ctx.Request)
globals.SugarLogger.Debugf("wxpayapi 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.OnWxPayCallback(msg)
}
}
if callbackResponse == nil {
callbackResponse = wxpayapi.SuccessResponse
} else if err != nil {
callbackResponse = wxpayapi.Err2CallbackResponse(err, "")
}
c.Data["xml"] = callbackResponse
c.ServeXML()
} else {
c.Abort("404")
}
}