This commit is contained in:
2026-08-05 10:31:38 +08:00
parent 83c0865272
commit b4e5e98353
3 changed files with 20 additions and 20 deletions

View File

@@ -29,7 +29,7 @@ class Ticket extends BaseController
$result = $ticketService->getTicketList($params);
return $this->success('查询成功', $result);
return $this->success(200, '查询成功', $result);
}
@@ -42,9 +42,9 @@ class Ticket extends BaseController
try {
$result = $ticketService->createTicket($data);
return $this->success('创建成功', $result);
return $this->success(200, '创建成功', $result);
} catch (\Exception $e) {
return $this->error($e->getMessage());
return $this->error(400, $e->getMessage());
}
}
@@ -62,9 +62,9 @@ class Ticket extends BaseController
try {
$result = $ticketService->updateTicket($id, $data, $allowFields, $adminId, true);
return $this->success('更新成功', $result);
return $this->success(200, '更新成功', $result);
} catch (\Exception $e) {
return $this->error($e->getMessage());
return $this->error(400, $e->getMessage());
}
}
@@ -75,7 +75,7 @@ class Ticket extends BaseController
public function getTicketDashboardStats(TicketService $ticketService)
{
$result = $ticketService->getTicketDashboardStats();
return $this->success('查询成功', $result);
return $this->success(200, '查询成功', $result);
}
/**
@@ -88,16 +88,16 @@ class Ticket extends BaseController
$ids = $data['ids'] ?? [];
if (!is_array($ids) || empty($ids)) {
return $this->error('ids 必须是非空数组');
return $this->error(400, 'ids 必须是非空数组');
}
$allowFields = ['status', 'lock_time'];
try {
$result = $ticketService->batchUpdateTickets($ids, $data, $allowFields, $adminId, true);
return $this->success('批量更新成功', $result);
return $this->success(200, '批量更新成功', $result);
} catch (\Exception $e) {
return $this->error($e->getMessage());
return $this->error(400, $e->getMessage());
}
}
@@ -107,10 +107,10 @@ class Ticket extends BaseController
public function deleteTicket($id)
{
$ticket = Tickets::find($id);
if (!$ticket) return $this->error('工单不存在');
if (!$ticket) return $this->error(400, '工单不存在');
return $ticket->delete()
? $this->success('删除成功', [])
: $this->error('删除失败', []);
? $this->success(200, '删除成功', [])
: $this->error(400, '删除失败', []);
}
}