From 239997dff16dc7530596eec189bac15ac73a1dc2 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 19 Sep 2022 10:42:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Wechat.php | 3 ++- app/view/wechat/payment.html | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controller/Wechat.php b/app/controller/Wechat.php index b600643..eb98351 100644 --- a/app/controller/Wechat.php +++ b/app/controller/Wechat.php @@ -101,6 +101,7 @@ class Wechat { $clientToken = Request::get('token'); $orderId = Request::get('order_id'); + $callback = Request::get('callback'); if ($clientToken) { $tk = json_decode(authcode($clientToken), true); $userId = $tk['userid']; @@ -150,7 +151,7 @@ class Wechat } $prepayId = $unify['prepay_id']; $jssdk = $payment->jssdk->bridgeConfig($prepayId, false); - return View::fetch('', ['jssdk' => $jssdk]); + return View::fetch('', ['jssdk' => $jssdk, 'callback' => $callback]); } /** diff --git a/app/view/wechat/payment.html b/app/view/wechat/payment.html index 211e2bf..34fe458 100644 --- a/app/view/wechat/payment.html +++ b/app/view/wechat/payment.html @@ -49,7 +49,8 @@ , btn: ['3秒后自动返回'] , time: 3 , end: function () { - window.history.back() + window.local.href = '{$callback}'; + // window.history.back() } }); }, 1000); @@ -60,7 +61,7 @@ , btn: ['3秒后自动返回'] , time: 3 , end: function () { - window.history.back() + window.local.href = '{$callback}'; } }); } From b071bf6ede43c32e56073fbb71de2b6e43082deb Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 19 Sep 2022 10:43:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Wechat.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controller/Wechat.php b/app/controller/Wechat.php index eb98351..b386ed9 100644 --- a/app/controller/Wechat.php +++ b/app/controller/Wechat.php @@ -102,6 +102,9 @@ class Wechat $clientToken = Request::get('token'); $orderId = Request::get('order_id'); $callback = Request::get('callback'); + $sep = str_contains($callback, '?') ? '&' : '?'; + $callback = $callback.$sep.'refresh=true'; + if ($clientToken) { $tk = json_decode(authcode($clientToken), true); $userId = $tk['userid'];