Browse Source

购物车锁表

master
weigang 5 years ago
parent
commit
6020642d0e
  1. 2
      app/Service/v3/Implementations/ShopCartUpdateService.php

2
app/Service/v3/Implementations/ShopCartUpdateService.php

@ -50,7 +50,7 @@ class ShopCartUpdateService implements ShopCartUpdateServiceInterface
throw new ErrorCodeException($goodsCheck); throw new ErrorCodeException($goodsCheck);
} }
return ShoppingCart::query()->updateOrCreate(
return ShoppingCart::query()->lockForUpdate()->updateOrCreate(
[ [
'user_id' => $userId, 'user_id' => $userId,
'goods_id' => $goodsId, 'goods_id' => $goodsId,

Loading…
Cancel
Save