From 2de3c6b8bf9a8560571be6126ff73ed117a2120e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 18 Aug 2022 11:08:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#10000=20=E5=BA=93=E5=AD=98=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BF=AE=E6=94=B9,=E7=B4=A2=E5=BC=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/StockUpdateListener.php | 2 +- app/Listeners/UpdateBusinessGoodsStock.php | 2 +- app/Services/Business/KuaiTuanTuan/Goods.php | 2 +- .../2022_08_05_030834_create_business_goods_skus_table.php | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Listeners/StockUpdateListener.php b/app/Listeners/StockUpdateListener.php index 0897976..e9c8d97 100644 --- a/app/Listeners/StockUpdateListener.php +++ b/app/Listeners/StockUpdateListener.php @@ -29,7 +29,7 @@ class StockUpdateListener */ public function handle(StockUpdateEvent $event) { - $shops = Shop::query()->where('status', 1)->get(['id', 'plat_id']); + $shops = Shop::query()->whereNotIn('status', [0, 3])->get(['id', 'plat_id']); if (empty($shops)) { return; } diff --git a/app/Listeners/UpdateBusinessGoodsStock.php b/app/Listeners/UpdateBusinessGoodsStock.php index e29d2ac..e60d100 100644 --- a/app/Listeners/UpdateBusinessGoodsStock.php +++ b/app/Listeners/UpdateBusinessGoodsStock.php @@ -45,7 +45,7 @@ class UpdateBusinessGoodsStock implements ShouldQueue return; } - $shops = Shop::query()->where('id', '<>', $event->businessOrderItem['shop_id'])->where('status', 1)->get(['id', 'plat_id']); + $shops = Shop::query()->where('id', '<>', $event->businessOrderItem['shop_id'])->whereNotIn('status', [0, 3])->get(['id', 'plat_id']); if (empty($shops)) { return; } diff --git a/app/Services/Business/KuaiTuanTuan/Goods.php b/app/Services/Business/KuaiTuanTuan/Goods.php index 9de4778..f3613b6 100644 --- a/app/Services/Business/KuaiTuanTuan/Goods.php +++ b/app/Services/Business/KuaiTuanTuan/Goods.php @@ -32,7 +32,7 @@ class Goods $sku['spec_list'] = json_encode($sku['spec_list'], 256); $data = array_merge($businessGood, $sku); BusinessGoodsSku::updateOrCreate( - ['shop_id' => $shopId, 'activity_no' => $businessGood['activity_no'], 'goods_id' => $businessGood['goods_id'], 'sku_id' => $sku['sku_id']], + ['shop_id' => $shopId, 'goods_id' => $businessGood['goods_id'], 'sku_id' => $sku['sku_id']], $data ); } diff --git a/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php b/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php index 7a84e15..c768bc7 100644 --- a/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php +++ b/database/migrations/2022_08_05_030834_create_business_goods_skus_table.php @@ -41,6 +41,8 @@ class CreateBusinessGoodsSkusTable extends Migration $table->string('thumb_url')->nullable(); $table->bigInteger('total_quantity')->nullable(); $table->timestamps(); + $table->index(['shop_id', 'goods_id', 'sku_id']); + $table->index(['shop_id', 'external_sku_id']); }); }