微信支付退款
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/wxpay"
|
||||
@@ -16,15 +17,18 @@ type WXPayController struct {
|
||||
func (c *WXPayController) Msg() {
|
||||
if c.Ctx.Input.Method() == http.MethodPost {
|
||||
msg, callbackResponse := api.WxpayAPI.GetCallbackMsg(c.Ctx.Request)
|
||||
var err error
|
||||
if callbackResponse == nil {
|
||||
if err := localjx.OnWxPayCallback(msg); err != nil {
|
||||
if msg.MsgType != wxpay.MsgTypeUnkown {
|
||||
callbackResponse = wxpay.Err2CallbackResponse(err, "")
|
||||
}
|
||||
if msg.MsgType != wxpay.MsgTypeUnkown {
|
||||
err = fmt.Errorf("未知的微信支付回调类型:%d", msg.MsgType)
|
||||
} else {
|
||||
err = localjx.OnWxPayCallback(msg)
|
||||
}
|
||||
}
|
||||
if callbackResponse == nil {
|
||||
callbackResponse = wxpay.SuccessResponse
|
||||
} else if err != nil {
|
||||
callbackResponse = wxpay.Err2CallbackResponse(err, "")
|
||||
}
|
||||
c.Data["xml"] = callbackResponse
|
||||
c.ServeXML()
|
||||
|
||||
Reference in New Issue
Block a user