2023-12-26 23:47:34 +08:00
|
|
|
import type { DataGrid, Pagination } from '@/types/global';
|
|
|
|
|
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 主机连接日志查询请求
|
|
|
|
|
*/
|
|
|
|
|
export interface HostConnectLogQueryRequest extends Pagination {
|
|
|
|
|
userId?: number;
|
|
|
|
|
hostId?: number;
|
|
|
|
|
hostAddress?: string;
|
|
|
|
|
type?: string;
|
|
|
|
|
token?: string;
|
|
|
|
|
status?: string;
|
2023-12-27 12:31:18 +08:00
|
|
|
startTimeRange?: string[];
|
2023-12-26 23:47:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 主机连接日志查询响应
|
|
|
|
|
*/
|
|
|
|
|
export interface HostConnectLogQueryResponse extends TableData {
|
|
|
|
|
id: number;
|
|
|
|
|
userId: number;
|
|
|
|
|
hostId: number;
|
|
|
|
|
hostName: string;
|
|
|
|
|
hostAddress: string;
|
|
|
|
|
type: string;
|
|
|
|
|
token: string;
|
|
|
|
|
status: string;
|
|
|
|
|
startTime: number;
|
|
|
|
|
endTime: number;
|
|
|
|
|
extraInfo: string;
|
|
|
|
|
createTime: number;
|
|
|
|
|
updateTime: number;
|
|
|
|
|
creator: string;
|
|
|
|
|
updater: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询主机连接日志
|
|
|
|
|
*/
|
|
|
|
|
export function getHostConnectLogPage(request: HostConnectLogQueryRequest) {
|
|
|
|
|
return axios.post<DataGrid<HostConnectLogQueryResponse>>('/asset/host-connect-log/query', request);
|
|
|
|
|
}
|
2024-01-09 01:15:35 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询用户最近连接的主机
|
|
|
|
|
*/
|
|
|
|
|
export function getLatestConnectHostId(type: string, limit: number) {
|
|
|
|
|
return axios.post<Array<number>>('/asset/host-connect-log/latest-connect', {
|
|
|
|
|
type,
|
|
|
|
|
limit
|
|
|
|
|
});
|
|
|
|
|
}
|