diff --git a/app/Http/Controllers/V1/Admin/OrderController.php b/app/Http/Controllers/V1/Admin/OrderController.php index 2462cda..07270b8 100644 --- a/app/Http/Controllers/V1/Admin/OrderController.php +++ b/app/Http/Controllers/V1/Admin/OrderController.php @@ -172,6 +172,7 @@ class OrderController extends Controller $orderService->setInvite($user); if (!$order->save()) { + DB::rollBack(); return $this->fail([500 ,'订单创建失败']); } DB::commit(); diff --git a/app/Http/Controllers/V1/Admin/PlanController.php b/app/Http/Controllers/V1/Admin/PlanController.php index 79c63c7..3015841 100755 --- a/app/Http/Controllers/V1/Admin/PlanController.php +++ b/app/Http/Controllers/V1/Admin/PlanController.php @@ -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 ,'创建失败']); diff --git a/app/Http/Controllers/V1/User/OrderController.php b/app/Http/Controllers/V1/User/OrderController.php index 8bff4a2..e9fe203 100755 --- a/app/Http/Controllers/V1/User/OrderController.php +++ b/app/Http/Controllers/V1/User/OrderController.php @@ -144,6 +144,7 @@ class OrderController extends Controller } if (!$order->save()) { + DB::rollBack(); return $this->fail([400, __('Failed to create order')]); } DB::commit(); diff --git a/app/Http/Controllers/V1/User/TicketController.php b/app/Http/Controllers/V1/User/TicketController.php index bbb07e5..8acb34f 100644 --- a/app/Http/Controllers/V1/User/TicketController.php +++ b/app/Http/Controllers/V1/User/TicketController.php @@ -169,6 +169,7 @@ class TicketController extends Controller 'message' => $message ]); if (!$ticketMessage) { + DB::rollBack(); return $this->fail([400, __('Failed to open ticket')]); } DB::commit();