|
...
|
...
|
@@ -17,10 +17,10 @@ class TicketChatController extends Controller |
|
|
|
*/
|
|
|
|
public function index($project_id, $ticket_id)
|
|
|
|
{
|
|
|
|
$ticket = Tickets::find($ticket_id);;
|
|
|
|
if (!$ticket) return response('工单未找到', 404);
|
|
|
|
if ($ticket->project->uuid !== $project_id) return response('无权限查看该工单', 403);
|
|
|
|
if ($ticket->project->is_del) return response('项目状态异常', 400);
|
|
|
|
$ticket = Tickets::find($ticket_id);
|
|
|
|
if (!$ticket) return response()->json(['message' => '工单未找到'], 404);
|
|
|
|
if ($ticket->project->uuid !== $project_id) return response()->json(['message' => '无权限查看该工单'], 403);
|
|
|
|
if ($ticket->project->is_del) return response()->json(['message' => '项目状态异常'], 400);
|
|
|
|
|
|
|
|
$chats = TicketChat::where('ticket_id', $ticket->id)
|
|
|
|
->get();
|
|
...
|
...
|
@@ -47,10 +47,11 @@ class TicketChatController extends Controller |
|
|
|
{
|
|
|
|
$request->validated();
|
|
|
|
$ticket = Tickets::with(['project'])->find($ticket_id);
|
|
|
|
if (!$ticket) return response('工单未找到', 404);
|
|
|
|
if ($ticket->status >= Tickets::STATUS_COMPLETED) return response('工单已完成或已关闭', 400);
|
|
|
|
if ($ticket->project->uuid !== $project_id) return response('无权限查看该工单', 403);
|
|
|
|
if ($ticket->project->is_del) return response('项目状态异常', 400);
|
|
|
|
if (!$ticket) return response()->json(['message' => '工单未找到'], 404);
|
|
|
|
if ($ticket->status >= Tickets::STATUS_COMPLETED) return response()->json(['message' => '工单已完成或已关闭'], 400);
|
|
|
|
|
|
|
|
if ($ticket->project->uuid !== $project_id) return response()->json(['message' => '无权限查看该工单'], 403);
|
|
|
|
if ($ticket->project->is_del) return response()->json(['message' => '项目状态异常'], 400);
|
|
|
|
|
|
|
|
$chat = new TicketChat();
|
|
|
|
$chat->ticket_id = $ticket->id;
|
...
|
...
|
|