From ca9b805cb660dae99f60193cd289b320fe387d21 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Wed, 18 May 2022 14:48:05 +0800 Subject: [PATCH] order-pre --- app/Services/OrderService.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 5230bc1b..e01712e0 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -110,11 +110,13 @@ class OrderService ?string $note = null, ?BargainOrder $bargainOrder = null, ): Order { - foreach ($products as $product) { - $sku = $product['sku']; - - if ($product['quantity'] > $sku->saleable_stock) { - throw new BizException('商品库存不足'); + if ($shippingAddressId) { + foreach ($products as $product) { + $sku = $product['sku']; + + if ($product['quantity'] > $sku->saleable_stock) { + throw new BizException('商品库存不足'); + } } }