From 08794dd9d8f057511abe49b1cbe972db202a1640 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 4 Jun 2024 18:16:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=95=E8=8E=B7=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PaymentLogic.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php index 852e8aa9e..2ae9d5f8b 100644 --- a/app/common/logic/PaymentLogic.php +++ b/app/common/logic/PaymentLogic.php @@ -7,6 +7,7 @@ namespace app\common\logic; use app\common\enum\PayEnum; use app\common\model\user\UserAuth; use app\common\service\pay\PayService; +use Illuminate\Support\Facades\Log; use Yansongda\Artful\Exception\Exception as ExceptionException; use Yansongda\Pay\Exception\Exception; @@ -55,7 +56,14 @@ class PaymentLogic extends BaseLogic 'attach' => $from ]; $wechat = new PayService(1); - $result = $wechat->wechat->mini($order)->toArray(); + try { + // 尝试执行可能会抛出异常的代码 + $result = $wechat->wechat->mini($order)->toArray(); + + } catch (\Exception $e) { + \support\Log::info($e->getMessage()); + throw new \Exception($e->getMessage()); + } break; default: self::$error = '订单异常';