!25 库存同步修改

Merge pull request !25 from develop
This commit is contained in:
赵世界 2022-08-18 03:09:35 +00:00 committed by Gitee
commit b9ef5270d5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 5 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

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

View File

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