feat: #10000 库存同步修改,索引优化
This commit is contained in:
parent
ed5fd2f5f2
commit
2de3c6b8bf
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user