From 1e26b4367b88810e1d7ef81fa1316190f2b134a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D?= <邮箱>
Date: Tue, 1 Aug 2023 14:05:21 +0800
Subject: [PATCH] test
---
mobile/blank.php | 67 +++++++++++++++++++++++++++++++
mobile/plugins/payment/wxpay.php | 85 +++++++++++++++++++++-------------------
2 files changed, 111 insertions(+), 41 deletions(-)
create mode 100644 mobile/blank.php
diff --git a/mobile/blank.php b/mobile/blank.php
new file mode 100644
index 0000000..d084098
--- /dev/null
+++ b/mobile/blank.php
@@ -0,0 +1,67 @@
+openid);
+ $_SESSION['openid'] = $response->openid;
+ // return $response->openid;
+
+ // 跳回原来的页面
+ $redirect_url = $referer;
+ header("Location: $redirect_url");
+ exit;
+
+} else {
+ // 如果没有授权,则重定向到授权页面
+ header('Location: ' . $auth_url);
+ var_dump($_GET['code']);
+ exit();
+}
+
+?>
\ No newline at end of file
diff --git a/mobile/plugins/payment/wxpay.php b/mobile/plugins/payment/wxpay.php
index b132927..b589523 100755
--- a/mobile/plugins/payment/wxpay.php
+++ b/mobile/plugins/payment/wxpay.php
@@ -112,7 +112,7 @@ class wxpay
{
$appid = 'wx79343915f99167e6';
$appsecret = 'f2f72c5e0ac29c2373bfaf22cf059c02';
- $redirect_uri = 'https://shop.heavenk.com/mobile/plugins/payment/wxpay.php'; // 回调URL
+ $redirect_uri = 'https://shop.heavenk.com/mobile/blank.php'; // 回调URL
// 构造授权链接
$auth_url = 'https://open.weixin.qq.com/connect/oauth2/authorize'
@@ -188,6 +188,8 @@ class wxpay
// return false;
// $openid = $this->get_openid();
+ header('Location: https://shop.heavenk.com/mobile/blank.php');
+ exit; // 终止当前脚本的执行,确保页面跳转生效
// $_SESSION['openid'] = $openid;
}
@@ -201,46 +203,46 @@ class wxpay
$this->setParameter("notify_url", __URL__ . 'wxpay.php'); // 通知地址
$this->setParameter("trade_type", "JSAPI"); // 交易类型
- // $prepay_id = $this->getPrepayId();
- // $jsApiParameters = $this->getParameters($prepay_id);
+ $prepay_id = $this->getPrepayId();
+ $jsApiParameters = $this->getParameters($prepay_id);
// wxjsbridge
- // $js = '
- // ';
-
- // $button = '微信支付(测试)' . $js;
- $button = '微信支付(测试)';
+ $js = '
+ ';
+
+ $button = '微信支付(测试)' . $js;
+ // $button = '微信支付(测试)';
return $button;
@@ -452,7 +454,8 @@ class wxpay
function getPrepayId()
{
// 设置接口链接
- $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+ // $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+ $url = "https://epay.dalianpay.cn/payapi/unitorder/pay";
try {
// 检测必填参数
if ($this->parameters["out_trade_no"] == null) {