From afb68866405d0ef4f3c94a10404ec8ac795cab2d 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, 23 Mar 2024 11:28:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/BatchStockUpdateListener.php | 7 ++++--- app/Listeners/StockUpdateListener.php | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Listeners/BatchStockUpdateListener.php b/app/Listeners/BatchStockUpdateListener.php index e80ebd4..4dcceaa 100644 --- a/app/Listeners/BatchStockUpdateListener.php +++ b/app/Listeners/BatchStockUpdateListener.php @@ -3,15 +3,16 @@ namespace App\Listeners; use App\Events\BatchStockUpdateEvent; -use App\Jobs\BusinessGoodsSkuIncrQuantity; use App\Models\BusinessGoodsSku; use App\Models\Shop; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use App\Services\Business\BusinessFactory; -class BatchStockUpdateListener +class BatchStockUpdateListener implements ShouldQueue { + use InteractsWithQueue; + /** * Create the event listener. * @@ -32,7 +33,7 @@ class BatchStockUpdateListener { $shops = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP])->get(['id', 'plat_id']); if (empty($shops)) { - return false; + return; } foreach ($shops as $shop) { foreach ($event->goodsSkus as $goodsSku) { diff --git a/app/Listeners/StockUpdateListener.php b/app/Listeners/StockUpdateListener.php index 4908e78..f71014d 100644 --- a/app/Listeners/StockUpdateListener.php +++ b/app/Listeners/StockUpdateListener.php @@ -9,8 +9,10 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use App\Services\Business\BusinessFactory; -class StockUpdateListener +class StockUpdateListener implements ShouldQueue { + use InteractsWithQueue; + /** * Create the event listener. * @@ -31,7 +33,7 @@ class StockUpdateListener { $shops = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP])->get(['id', 'plat_id']); if (empty($shops)) { - return false; + return; } foreach ($shops as $shop) { $num = $event->goodsSku->stock;