From 447fb212ec2335b98e4c5e0b6a03385a6ea984a0 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Tue, 6 May 2025 14:19:51 +0800 Subject: [PATCH] no message --- src/Services/Gateway/Epay.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Services/Gateway/Epay.php b/src/Services/Gateway/Epay.php index 6236b750..da32e6dd 100755 --- a/src/Services/Gateway/Epay.php +++ b/src/Services/Gateway/Epay.php @@ -120,8 +120,17 @@ final class Epay extends Base $resData = json_decode($res->getBody()->__toString(), true); - if ($resData['code'] !== 1 || ! isset($resData['payurl'])) { - throw new Exception("没有payurl"); + if ($resData['code'] !== 1) { + throw new Exception("code不等于1"); + } + + // 如果没有payurl,把qrcode当payurl + if (!isset($resData['payurl'])) { + if (isset($resData['qrcode'])) { + $resData['payurl'] = $resData['qrcode']; + } else { + throw new Exception("没有payurl,也没有qrcode"); + } } return $response->withHeader('HX-Redirect', $resData['payurl'])->withJson([ @@ -129,13 +138,7 @@ final class Epay extends Base 'msg' => '订单发起成功,正在跳转到支付页面...', ]); } catch (Exception|GuzzleException $e) { -// if ($user["is_admin"] == 1) { -// return $response->withJson([ -// 'ret' => 0, -// 'msg' => json_encode($e->getMessage()), -// ]); -// } else { - + $aMsg = [ '标题' => '有用户支付失败', '报错' => $e->getMessage(), @@ -152,8 +155,6 @@ final class Epay extends Base 'msg' => '请求支付失败,请联系管理员', ]); -// } - } }