From ebc939e1d7ad973b1a318fbf7121af4b25845f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=93=AD=E6=98=95?= <715557344@qq.com> Date: Wed, 7 Sep 2022 16:42:18 +0800 Subject: [PATCH] Fixed undefined array key `wechat_public_cert_path` when don't set it. (#674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed undefined array key `wechat_public_cert_path` when don't set it. * refactor: 优化 `wechat_public_cert_path` 配置 Co-authored-by: yansongda --- CHANGELOG.md | 10 ++++++++++ src/Functions.php | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2058803..c94e562 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## v3.2.1 + +### fixed + +- fix: `wechat_public_cert_path` 未配置时报错的问题(#674) + +### refactor + +- refactor: 优化 `wechat_public_cert_path` 配置(#674) + ## v3.2.0 ### changed diff --git a/src/Functions.php b/src/Functions.php index ccbc7fa..29c559a 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -221,11 +221,11 @@ if (!function_exists('reload_wechat_public_certs')) { } $wechatConfig = get_wechat_config($params); - $wechatConfig['wechat_public_cert_path'] = ((array) $wechatConfig['wechat_public_cert_path']) + ($certs ?? []); - Pay::set(ConfigInterface::class, Pay::get(ConfigInterface::class)->merge([ - 'wechat' => [$params['_config'] ?? 'default' => $wechatConfig], - ])); + Pay::get(ConfigInterface::class)->set( + 'wechat.'.get_tenant($params).'.wechat_public_cert_path', + ((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []), + ); if (!is_null($serialNo) && empty($certs[$serialNo])) { throw new InvalidConfigException(Exception::WECHAT_CONFIG_ERROR, 'Get Wechat Public Cert Error');