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]); - } - } -}