mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
增加锁
This commit is contained in:
parent
c017753fe6
commit
495253e791
@ -64,7 +64,7 @@ class CombinationGoodsStockUpdateListener implements ShouldQueue
|
||||
->get();
|
||||
foreach ($combinationGoods as $item) {
|
||||
DB::transaction(function () use ($item, &$updateIds) {
|
||||
$goodsSku = GoodsSku::query()->find($item['item_id'])->lockForUpdate();
|
||||
$goodsSku = GoodsSku::query()->lockForUpdate()->find($item['item_id']);
|
||||
$stock = $goodsSku->stock - $item['item_num'];
|
||||
//新增逻辑 在线库存同步扣减
|
||||
$saleStock = max($goodsSku->sale_stock - $item['item_num'], 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user