feat: 微信支付成功跳转return

This commit is contained in:
wolter 2024-12-07 15:09:02 +08:00
parent 964a0808b9
commit cfec0f5fca
4 changed files with 4 additions and 0 deletions

View File

@ -241,6 +241,7 @@ func WxJsApiPay(c *gin.Context) {
"package": rsp.Package, "package": rsp.Package,
"signType": rsp.SignType, "signType": rsp.SignType,
"paySign": rsp.PaySign, "paySign": rsp.PaySign,
"returnUrl": rsp.ReturnUrl,
}) })
} else { } else {
utils.Log(c, "", "WxJsApiPay,支付失败code=", code, "msg=", rsp.ThirdMsg) utils.Log(c, "", "WxJsApiPay,支付失败code=", code, "msg=", rsp.ThirdMsg)

View File

@ -42,4 +42,5 @@ type WxJsApiPayResponse struct {
SignType string `json:"signType"` SignType string `json:"signType"`
PaySign string `json:"paySign"` PaySign string `json:"paySign"`
ThirdMsg string `json:"third_msg"` ThirdMsg string `json:"third_msg"`
ReturnUrl string
} }

View File

@ -344,6 +344,7 @@ func WxJsApiPay(param front.WxJsApiPayRequest) (response front.WxJsApiPayRespons
return response, errorcode.WechatAuthFail return response, errorcode.WechatAuthFail
} }
response.PaySign = signValue response.PaySign = signValue
response.ReturnUrl = task.orderPayRequest.ReturnUrl
return response, task.code return response, task.code
} }

View File

@ -107,6 +107,7 @@
//res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。 //res.err_msg将在用户支付成功后返回ok但并不保证它绝对可靠。
document.getElementsByClassName('success')[0].style.display = 'block'; document.getElementsByClassName('success')[0].style.display = 'block';
document.getElementsByClassName('error')[0].style.display = 'none'; document.getElementsByClassName('error')[0].style.display = 'none';
window.location.href = {{.returnUrl}}; // 跳转
} else { } else {
document.getElementsByClassName('error')[0].style.display = 'block'; document.getElementsByClassName('error')[0].style.display = 'block';
document.getElementsByClassName('success')[0].style.display = 'none'; document.getElementsByClassName('success')[0].style.display = 'none';