fix: 修复多处可能出现的事务安全问题

This commit is contained in:
xboard
2023-12-14 13:07:57 +08:00
parent b8009142ed
commit 7bac88d593
4 changed files with 4 additions and 1 deletions

View File

@@ -49,12 +49,12 @@ class PlanController extends Controller
}
$plan->update($params);
DB::commit();
return $this->success(true);
} catch (\Exception $e) {
DB::rollBack();
\Log::error($e);
return $this->fail([500 ,'保存失败']);
}
return $this->success(true);
}
if (!Plan::create($params)) {
return $this->fail([500 ,'创建失败']);