正在显示
1 个修改的文件
包含
9 行增加
和
8 行删除
| @@ -17,10 +17,10 @@ class TicketChatController extends Controller | @@ -17,10 +17,10 @@ class TicketChatController extends Controller | ||
| 17 | */ | 17 | */ |
| 18 | public function index($project_id, $ticket_id) | 18 | public function index($project_id, $ticket_id) |
| 19 | { | 19 | { |
| 20 | - $ticket = Tickets::find($ticket_id);; | ||
| 21 | - if (!$ticket) return response('工单未找到', 404); | ||
| 22 | - if ($ticket->project->uuid !== $project_id) return response('无权限查看该工单', 403); | ||
| 23 | - if ($ticket->project->is_del) return response('项目状态异常', 400); | 20 | + $ticket = Tickets::find($ticket_id); |
| 21 | + if (!$ticket) return response()->json(['message' => '工单未找到'], 404); | ||
| 22 | + if ($ticket->project->uuid !== $project_id) return response()->json(['message' => '无权限查看该工单'], 403); | ||
| 23 | + if ($ticket->project->is_del) return response()->json(['message' => '项目状态异常'], 400); | ||
| 24 | 24 | ||
| 25 | $chats = TicketChat::where('ticket_id', $ticket->id) | 25 | $chats = TicketChat::where('ticket_id', $ticket->id) |
| 26 | ->get(); | 26 | ->get(); |
| @@ -47,10 +47,11 @@ class TicketChatController extends Controller | @@ -47,10 +47,11 @@ class TicketChatController extends Controller | ||
| 47 | { | 47 | { |
| 48 | $request->validated(); | 48 | $request->validated(); |
| 49 | $ticket = Tickets::with(['project'])->find($ticket_id); | 49 | $ticket = Tickets::with(['project'])->find($ticket_id); |
| 50 | - if (!$ticket) return response('工单未找到', 404); | ||
| 51 | - if ($ticket->status >= Tickets::STATUS_COMPLETED) return response('工单已完成或已关闭', 400); | ||
| 52 | - if ($ticket->project->uuid !== $project_id) return response('无权限查看该工单', 403); | ||
| 53 | - if ($ticket->project->is_del) return response('项目状态异常', 400); | 50 | + if (!$ticket) return response()->json(['message' => '工单未找到'], 404); |
| 51 | + if ($ticket->status >= Tickets::STATUS_COMPLETED) return response()->json(['message' => '工单已完成或已关闭'], 400); | ||
| 52 | + | ||
| 53 | + if ($ticket->project->uuid !== $project_id) return response()->json(['message' => '无权限查看该工单'], 403); | ||
| 54 | + if ($ticket->project->is_del) return response()->json(['message' => '项目状态异常'], 400); | ||
| 54 | 55 | ||
| 55 | $chat = new TicketChat(); | 56 | $chat = new TicketChat(); |
| 56 | $chat->ticket_id = $ticket->id; | 57 | $chat->ticket_id = $ticket->id; |
-
请 注册 或 登录 后发表评论