From d30d0f393b3356f4000954d9990fa6f46f2114ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 19 Mar 2025 10:56:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9F=E8=AE=A1=20WechatService::getC?= =?UTF-8?q?onfig=20=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/think-plugs-wechat/src/service/PaymentService.php | 4 ++-- plugin/think-plugs-wechat/src/service/WechatService.php | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugin/think-plugs-wechat/src/service/PaymentService.php b/plugin/think-plugs-wechat/src/service/PaymentService.php index ee6a59860..c9c8ba3bb 100644 --- a/plugin/think-plugs-wechat/src/service/PaymentService.php +++ b/plugin/think-plugs-wechat/src/service/PaymentService.php @@ -82,7 +82,7 @@ class PaymentService if ($oPayed + $pAmount > floatval($oAmount)) { return ['code' => 0, 'info' => '支付总额超出!', 'data' => [], 'params' => []]; } - $config = WechatService::getConfig('', true); + $config = WechatService::getConfig(true); do $pCode = CodeExtend::uniqidNumber(16, 'P'); while (WechatPaymentRecord::mk()->master()->where(['code' => $pCode])->findOrEmpty()->isExists()); $data = [ @@ -328,7 +328,7 @@ class PaymentService */ protected static function withPayment(?array $config = null): Order { - return Order::instance($config ?: WechatService::getConfig('', true)); + return Order::instance($config ?: WechatService::getConfig(true)); } /** diff --git a/plugin/think-plugs-wechat/src/service/WechatService.php b/plugin/think-plugs-wechat/src/service/WechatService.php index b9ac86fc7..77dd6a267 100644 --- a/plugin/think-plugs-wechat/src/service/WechatService.php +++ b/plugin/think-plugs-wechat/src/service/WechatService.php @@ -178,15 +178,14 @@ class WechatService extends Service /** * 获取公众号配置参数 - * @param string $appid 指定公众号 * @param boolean $ispay 获取支付参数 * @return array * @throws \think\admin\Exception */ - public static function getConfig(string $appid = '', bool $ispay = false): array + public static function getConfig(bool $ispay = false): array { $config = [ - 'appid' => $appid ?: static::getAppid(), + 'appid' => static::getAppid(), 'token' => sysconf('wechat.token'), 'appsecret' => sysconf('wechat.appsecret'), 'encodingaeskey' => sysconf('wechat.encodingaeskey'), @@ -197,7 +196,7 @@ class WechatService extends Service /** * 获取小程序配置参数 - * @param boolean $ispay 支付参数 + * @param boolean $ispay 获取支付参数 * @return array * @throws \think\admin\Exception */