From 1b2afe18c164d22650feaf3b57a965e83a27e518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 3 Mar 2025 21:03:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/Config.php | 11 +++++-- .../src/view/config/payment.html | 30 +++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/plugin/think-plugs-wechat/src/controller/Config.php b/plugin/think-plugs-wechat/src/controller/Config.php index 71e8ee8d3..c452daba9 100644 --- a/plugin/think-plugs-wechat/src/controller/Config.php +++ b/plugin/think-plugs-wechat/src/controller/Config.php @@ -149,9 +149,11 @@ class Config extends Controller $this->mch_ssl_cer = sysconf('wechat.mch_ssl_cer'); $this->mch_ssl_key = sysconf('wechat.mch_ssl_key'); $this->mch_ssl_p12 = sysconf('wechat.mch_ssl_p12'); + $this->mch_ssl_pay = sysconf('wechat.mch_ssl_pay'); if (!$local->has($this->mch_ssl_cer, true)) $this->mch_ssl_cer = ''; if (!$local->has($this->mch_ssl_key, true)) $this->mch_ssl_key = ''; if (!$local->has($this->mch_ssl_p12, true)) $this->mch_ssl_p12 = ''; + if (!$local->has($this->mch_ssl_pay, true)) $this->mch_ssl_pay = ''; $this->fetch(); } else { $this->error('抱歉,数据提交地址错误!'); @@ -172,10 +174,13 @@ class Config extends Controller if ($wechat['mch_ssl_type'] === 'pem') { WechatService::withWxpayCert(['mch_id' => $wechat['mch_id']]); if (empty($wechat['mch_ssl_key']) || !$local->has($wechat['mch_ssl_key'], true)) { - $this->error('商户证书 KEY 不能为空!'); + $this->error('商户证书密钥不能为空!'); } if (empty($wechat['mch_ssl_cer']) || !$local->has($wechat['mch_ssl_cer'], true)) { - $this->error('商户证书 CERT 不能为空!'); + $this->error('商户证书公钥不能为空!'); + } + if (empty($wechat['mch_ssl_pay']) || !$local->has($wechat['mch_ssl_pay'], true)) { + $this->error('微信支付公钥不能为空!'); } } // P12 证书模式转 PEM 模式 @@ -200,6 +205,8 @@ class Config extends Controller 'mch_id' => $wechat['mch_id'], 'mch_key' => $wechat['mch_key'], 'mch_v3_key' => $wechat['mch_v3_key'], + 'ssl_pay_id' => $wechat['mch_v3_payid'] ?? '', + 'ssl_pay_text' => $local->get($wechat['ssl_cer_pay'], true), 'ssl_key_text' => $local->get($wechat['mch_ssl_key'], true), 'ssl_cer_text' => $local->get($wechat['mch_ssl_cer'], true), ]); diff --git a/plugin/think-plugs-wechat/src/view/config/payment.html b/plugin/think-plugs-wechat/src/view/config/payment.html index 516830fa6..0fabdcaa1 100644 --- a/plugin/think-plugs-wechat/src/view/config/payment.html +++ b/plugin/think-plugs-wechat/src/view/config/payment.html @@ -21,7 +21,7 @@ 微信商户账号,需要在微信商户平台获取,MCH_ID 与 APPID 匹配 -