同步快团团用在售库存其他都是实际库存

This commit is contained in:
杨建炊 2024-09-21 14:41:55 +08:00
parent f9c0662282
commit 68168a0936
3 changed files with 16 additions and 4 deletions

View File

@ -40,7 +40,11 @@ class BatchStockUpdateListener implements ShouldQueue
try { try {
foreach ($shops as $shop) { foreach ($shops as $shop) {
foreach ($event->goodsSkus as $goodsSku) { foreach ($event->goodsSkus as $goodsSku) {
$num = $goodsSku->sale_stock; if ($shop['plat_id'] == "快团团") {
$num = $goodsSku->sale_stock;
} else {
$num = $goodsSku->stock;
}
$businessGoodsSkus = BusinessGoodsSku::query() $businessGoodsSkus = BusinessGoodsSku::query()
->select(['goods_id', 'sku_id', 'external_sku_id']) ->select(['goods_id', 'sku_id', 'external_sku_id'])
->where('shop_id', $shop->id) ->where('shop_id', $shop->id)
@ -52,7 +56,7 @@ class BatchStockUpdateListener implements ShouldQueue
} }
} }
} catch (\Exception $exception) { } catch (\Exception $exception) {
Log::error("同步三方库存出现异常",[$exception->getMessage()]); Log::error("同步三方库存出现异常", [$exception->getMessage()]);
} }
} }
} }

View File

@ -36,7 +36,11 @@ class StockUpdateListener implements ShouldQueue
return; return;
} }
foreach ($shops as $shop) { foreach ($shops as $shop) {
$num = $event->goodsSku->sale_stock; if ($shop['plat_id'] == "快团团") {
$num = $event->goodsSku->sale_stock;
} else {
$num = $event->goodsSku->stock;
}
$businessGoodsSkus = BusinessGoodsSku::query() $businessGoodsSkus = BusinessGoodsSku::query()
->select(['goods_id', 'sku_id', 'external_sku_id']) ->select(['goods_id', 'sku_id', 'external_sku_id'])
->where('shop_id', $shop->id) ->where('shop_id', $shop->id)

View File

@ -60,7 +60,11 @@ class UpdateBusinessGoodsStock implements ShouldQueue
} }
foreach ($shops as $shop) { foreach ($shops as $shop) {
$num = $event->goodsSku->sale_stock;//同步三方和秒选虚拟库存 if ($shop['plat_id'] == "快团团") {
$num = $event->goodsSku->sale_stock;
} else {
$num = $event->goodsSku->stock;
}
$businessGoodsSkus = BusinessGoodsSku::query() $businessGoodsSkus = BusinessGoodsSku::query()
->where('shop_id', $shop->id) ->where('shop_id', $shop->id)
->where('is_sync', 1) ->where('is_sync', 1)