From c6bcec76faadadb9771385922d0823bcaafe0c81 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sun, 23 Jun 2024 19:56:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(OrderLogic,=20PayNotifyLogic):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AE=A2=E5=8D=95=E5=92=8C=E6=94=AF=E4=BB=98=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BC=82=E5=B8=B8=E6=8D=95?= =?UTF-8?q?=E8=8E=B7=E5=92=8C=E5=A4=84=E7=90=86=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BA=86=E5=BA=93=E5=AD=98=E6=9B=B4=E6=96=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=BC=98=E5=8C=96=E4=BA=86=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 1 + app/common/logic/PayNotifyLogic.php | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 5385eed18..14654eab6 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -446,6 +446,7 @@ class OrderLogic extends BaseLogic return true; } catch (\Exception $e) { Db::rollback(); + d($e); self::setError($e->getMessage()); return false; } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 4e4993303..b8df492bd 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -742,11 +742,14 @@ class PayNotifyLogic extends BaseLogic 'product_id' => $v['product_id'], ] )->withTrashed()->find(); - $updateData[] = [ - 'id' => $StoreBranchProduct['id'], - 'stock' => $StoreBranchProduct['stock'] - $v['cart_num'], - 'sales' => ['inc', $v['cart_num']] - ]; + if($StoreBranchProduct){ + $updateData[] = [ + 'id' => $StoreBranchProduct['id'], + 'stock' => $StoreBranchProduct['stock'] - $v['cart_num'], + 'sales' => ['inc', $v['cart_num']] + ]; + } + } (new StoreBranchProduct())->saveAll($updateData);