From cf052f0047abbbd09b155bcdc0953a84881b0eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Wed, 22 Dec 2021 10:02:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1H5=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/WeChatPayService.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Services/WeChatPayService.php b/app/Services/WeChatPayService.php index b4c2ce72..fa382360 100644 --- a/app/Services/WeChatPayService.php +++ b/app/Services/WeChatPayService.php @@ -6,6 +6,7 @@ use App\Exceptions\WeChatPayException; use Closure; use EasyWeChat\Factory; use EasyWeChat\Payment\Application; +use Illuminate\Support\Arr; class WeChatPayService { @@ -83,13 +84,11 @@ class WeChatPayService ); } - $prepayId = $result['prepay_id']; - - if ($params['trade_type'] === static::TRADE_TYPE_APP) { - return $this->app->jssdk->appConfig($prepayId); - } - - return $this->app->jssdk->bridgeConfig($prepayId, false); + return match ($params['trade_type']) { + static::TRADE_TYPE_APP => $this->app->jssdk->appConfig($result['prepay_id']), + static::TRADE_TYPE_H5 => Arr::only($result, ['mweb_url']), + default => $this->app->jssdk->bridgeConfig($result['prepay_id'], false), + }; } /**