From cfec0f5fcac29fc839368193d5c1316648a187e5 Mon Sep 17 00:00:00 2001 From: wolter Date: Sat, 7 Dec 2024 15:09:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=B7=B3=E8=BD=ACreturn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/front/payment_controller.go | 1 + app/http/entities/front/wechat.go | 1 + app/services/thirdpay/wx.go | 1 + front/templates/success.html | 1 + 4 files changed, 4 insertions(+) diff --git a/app/http/controllers/front/payment_controller.go b/app/http/controllers/front/payment_controller.go index 0cd3ea4..94ae43f 100644 --- a/app/http/controllers/front/payment_controller.go +++ b/app/http/controllers/front/payment_controller.go @@ -241,6 +241,7 @@ func WxJsApiPay(c *gin.Context) { "package": rsp.Package, "signType": rsp.SignType, "paySign": rsp.PaySign, + "returnUrl": rsp.ReturnUrl, }) } else { utils.Log(c, "", "WxJsApiPay,支付失败code=", code, "msg=", rsp.ThirdMsg) diff --git a/app/http/entities/front/wechat.go b/app/http/entities/front/wechat.go index 42cefae..6358358 100644 --- a/app/http/entities/front/wechat.go +++ b/app/http/entities/front/wechat.go @@ -42,4 +42,5 @@ type WxJsApiPayResponse struct { SignType string `json:"signType"` PaySign string `json:"paySign"` ThirdMsg string `json:"third_msg"` + ReturnUrl string } diff --git a/app/services/thirdpay/wx.go b/app/services/thirdpay/wx.go index 271b962..0cd16ed 100644 --- a/app/services/thirdpay/wx.go +++ b/app/services/thirdpay/wx.go @@ -344,6 +344,7 @@ func WxJsApiPay(param front.WxJsApiPayRequest) (response front.WxJsApiPayRespons return response, errorcode.WechatAuthFail } response.PaySign = signValue + response.ReturnUrl = task.orderPayRequest.ReturnUrl return response, task.code } diff --git a/front/templates/success.html b/front/templates/success.html index a11c334..e1a50a6 100644 --- a/front/templates/success.html +++ b/front/templates/success.html @@ -107,6 +107,7 @@ //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 document.getElementsByClassName('success')[0].style.display = 'block'; document.getElementsByClassName('error')[0].style.display = 'none'; + window.location.href = {{.returnUrl}}; // 跳转 } else { document.getElementsByClassName('error')[0].style.display = 'block'; document.getElementsByClassName('success')[0].style.display = 'none';