From f95516e18271f5c59b34cb82384d3242f3536121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Sat, 20 Aug 2022 16:33:57 +0800 Subject: [PATCH] feat: --- app/Services/Business/BusinessClient.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index d9372ec..4ee85cf 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -46,9 +46,10 @@ abstract class BusinessClient $item['shop_id'] = $shopId; $orderItem = BusinessOrderItem::firstOrNew(['shop_id' => $shopId, 'business_order_id' => $orderRecord->id, 'goods_id' => $item['goods_id'], 'sku_id' => $item['sku_id']], $item); $num = 0; + $cancelNum = $item['already_cancel_number'] ?? 0; if (empty($orderItem->id)) { if ($item['cancel_status']) { - if ($num = $item['goods_number'] - $item['already_cancel_number']) { + if ($num = $item['goods_number'] - $cancelNum) { // 扣库存 $reduceNum $num = 0 - $num; } @@ -61,7 +62,7 @@ abstract class BusinessClient if ($item['cancel_status'] !== $orderItem->cancel_status) { if ($item['cancel_status']) { // 加库存 - $num = $item['already_cancel_number']; + $num = $cancelNum; } else { // 扣库存 $num = 0 - $item['goods_number'];