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