From c6e7f7edb65c8aadb2563eff8a0d08b7cdb7d932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Tue, 21 Nov 2023 16:35:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=9B=B4=E6=96=B0=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/BatchStockWarning.php | 55 ----------------------------- 1 file changed, 55 deletions(-) delete mode 100644 app/Listeners/BatchStockWarning.php diff --git a/app/Listeners/BatchStockWarning.php b/app/Listeners/BatchStockWarning.php deleted file mode 100644 index b1a5d1a..0000000 --- a/app/Listeners/BatchStockWarning.php +++ /dev/null @@ -1,55 +0,0 @@ -stockWarning) { - return; - } - $dailyStockRecord = DailyStockRecord::query() - ->where('day', DateTimeUtils::getToday()) - ->whereIn('sku_id', $event->goodsSkus->pluck('id')) - ->pluck('arrived_today_num', 'sku_id') - ->toArray(); - - $normalIds = $downIds = []; - foreach ($event->goodsSkus as $goodsSku) { - if (0 >= $goodsSku['stock']) { - $downIds[] = $goodsSku['id']; - } else { - $normalIds[] = $goodsSku['id']; - } - if (20 < $dailyStockRecord[$goodsSku['id']] + $goodsSku->yesterday_num && 4 > $goodsSku['stock']) { - $downIds[] = $goodsSku['id']; - } - } - if ($normalIds) { - GoodsSku::query()->whereIn('id', $normalIds)->update(['status' => 1]); - } - if ($downIds) { - GoodsSku::query()->whereIn('id', $downIds)->update(['status' => 0]); - } - } -}