6
0
Fork 0

微信H5支付

release
李静 2021-12-22 10:02:59 +08:00
parent 3b87d84079
commit cf052f0047
1 changed files with 6 additions and 7 deletions

View File

@ -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),
};
}
/**