最新版本
This commit is contained in:
@@ -22,7 +22,8 @@ class Ticket extends BaseController
|
||||
"page" => $this->request->param('page', 1, 'intval'),
|
||||
"limit" => $this->request->param('limit', 20, 'intval'),
|
||||
"status" => $this->request->param('status', null),
|
||||
"operator_name" => $this->request->param('operator_name', null),
|
||||
"operator_id" => $this->request->param('operator_id', null),
|
||||
"user_id" => $this->request->param('user_id', null),
|
||||
"searchKeyword" => $this->request->param('search', null),
|
||||
"sortOrder" => $this->request->param('sort_order', 'desc'),
|
||||
];
|
||||
@@ -69,6 +70,39 @@ class Ticket extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计各状态工单数量
|
||||
*/
|
||||
public function getTicketDashboardStats(TicketService $ticketService)
|
||||
{
|
||||
$result = $ticketService->getTicketDashboardStats();
|
||||
return json(['code' => 200, 'msg' => '查询成功', 'data' => $result]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新工单
|
||||
*/
|
||||
public function batchUpdate(TicketService $ticketService)
|
||||
{
|
||||
$adminId = Session::get('user_info.id'); // 获取当前登录管理员ID
|
||||
$data = $this->request->post();
|
||||
|
||||
$ids = $data['ids'] ?? [];
|
||||
if (!is_array($ids) || empty($ids)) {
|
||||
return json(['code' => 400, 'msg' => 'ids 必须是非空数组', 'data' => []]);
|
||||
}
|
||||
|
||||
$allowFields = ['status', 'lock_time'];
|
||||
|
||||
try {
|
||||
$result = $ticketService->batchUpdateTickets($ids, $data, $allowFields, $adminId, true);
|
||||
return json(['code' => 200, 'msg' => '批量更新成功', 'data' => $result]);
|
||||
} catch (\Exception $e) {
|
||||
return json(['code' => 400, 'msg' => $e->getMessage(), 'data' => []]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个工单(仅后台可调用)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user