From c20da03e7c3be077e2bcab72fae4244c723f2e92 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 31 Aug 2024 15:11:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8BusinessException?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E6=94=AF=E4=BB=98=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E5=92=8C=E8=AE=A2=E5=8D=95=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index a739dbf12..86a6910f0 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -30,6 +30,7 @@ use app\common\model\user_sign\UserSign; use app\common\model\vip_flow\VipFlow; use app\common\service\Curl; use app\common\service\PushService; +use support\exception\BusinessException; use support\Log; use think\facade\Db; use Webman\RedisQueue\Redis; @@ -52,7 +53,8 @@ class PayNotifyLogic extends BaseLogic } catch (\Exception $e) { Db::rollback(); Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile()); - throw new \Exception($e->getMessage()); + throw new BusinessException($e->getMessage()); + } } @@ -70,13 +72,13 @@ class PayNotifyLogic extends BaseLogic $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); $user = User::where('id', $order['uid'])->find(); if ($user['now_money'] < $order['pay_price']) { - throw new \Exception('余额不足'); + throw new BusinessException('余额不足'); } // $order->money = $order['pay_price']; $order->paid = 1; $order->pay_time = time(); if (!$order->save()) { - throw new \Exception('订单保存出错'); + throw new BusinessException('订单保存出错'); } if ($order['is_storage'] == 1) { $order->status = 2;