no message

This commit is contained in:
hellcat 2025-05-06 14:19:51 +08:00
parent 848c33808f
commit 447fb212ec

View File

@ -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' => '请求支付失败,请联系管理员',
]);
// }
}
}