mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
fix: 修复多处可能出现的事务安全问题
This commit is contained in:
parent
b8009142ed
commit
7bac88d593
@ -172,6 +172,7 @@ class OrderController extends Controller
|
||||
$orderService->setInvite($user);
|
||||
|
||||
if (!$order->save()) {
|
||||
DB::rollBack();
|
||||
return $this->fail([500 ,'订单创建失败']);
|
||||
}
|
||||
DB::commit();
|
||||
|
@ -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 ,'创建失败']);
|
||||
|
@ -144,6 +144,7 @@ class OrderController extends Controller
|
||||
}
|
||||
|
||||
if (!$order->save()) {
|
||||
DB::rollBack();
|
||||
return $this->fail([400, __('Failed to create order')]);
|
||||
}
|
||||
DB::commit();
|
||||
|
@ -169,6 +169,7 @@ class TicketController extends Controller
|
||||
'message' => $message
|
||||
]);
|
||||
if (!$ticketMessage) {
|
||||
DB::rollBack();
|
||||
return $this->fail([400, __('Failed to open ticket')]);
|
||||
}
|
||||
DB::commit();
|
||||
|
Loading…
Reference in New Issue
Block a user