DB::beginTransaction();
User::query()->where(['id' => 1])->lockForUpdate()->first();//加锁
业务逻辑......
$user = User::query()->where(['mobile' => $mobile])->first();
if (empty($user)) {
}
DB::commit();
DB::beginTransaction();
User::query()->where(['id' => 1])->lockForUpdate()->first();//加锁
业务逻辑......
$user = User::query()->where(['mobile' => $mobile])->first();
if (empty($user)) {
}
DB::commit();