mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-15 14:57:15 +08:00
优化:聚合日志相关 API,封装 date-range-picker 组件并优化部分细节
This commit is contained in:
99
continew-admin-ui/src/api/monitor/log.ts
Normal file
99
continew-admin-ui/src/api/monitor/log.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
export interface LogRecord {
|
||||
logId: string;
|
||||
clientIp: string;
|
||||
location: string;
|
||||
browser: string;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
export interface LoginLogRecord extends LogRecord {
|
||||
description: string;
|
||||
status: number;
|
||||
errorMsg: string;
|
||||
createUserString: string;
|
||||
}
|
||||
|
||||
export interface OperationLogRecord extends LogRecord {
|
||||
description: string;
|
||||
status: number;
|
||||
errorMsg: string;
|
||||
createUserString: string;
|
||||
}
|
||||
|
||||
export interface SystemLogRecord extends LogRecord {
|
||||
statusCode: number;
|
||||
requestMethod: string;
|
||||
requestUrl: string;
|
||||
elapsedTime: number;
|
||||
exceptionDetail?: string;
|
||||
}
|
||||
|
||||
export interface SystemLogDetailRecord extends SystemLogRecord {
|
||||
requestHeaders: string;
|
||||
requestBody: string;
|
||||
responseHeaders: string;
|
||||
responseBody: string;
|
||||
}
|
||||
|
||||
export interface LoginLogParams extends Partial<LoginLogRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
export interface LoginLogListRes {
|
||||
list: LoginLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
export function queryLoginLogList(params: LoginLogParams) {
|
||||
return axios.get<LoginLogListRes>('/monitor/log/login', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export interface OperationLogParams extends Partial<OperationLogRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
uid?: string;
|
||||
}
|
||||
export interface OperationLogListRes {
|
||||
list: OperationLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
export function queryOperationLogList(params: OperationLogParams) {
|
||||
return axios.get<OperationLogListRes>('/monitor/log/operation', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export interface SystemLogParams extends Partial<SystemLogRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
|
||||
export interface SystemLogListRes {
|
||||
list: SystemLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
export function querySystemLogList(params: SystemLogParams) {
|
||||
return axios.get<SystemLogListRes>('/monitor/log/system', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function querySystemLogDetail(logId: string) {
|
||||
return axios.get<SystemLogDetailRecord>(`/monitor/log/system/${logId}`);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
export interface LoginLogRecord {
|
||||
logId: string;
|
||||
status: number;
|
||||
clientIp: string;
|
||||
location: string;
|
||||
browser: string;
|
||||
errorMsg: string;
|
||||
createUserString: string;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
export interface LoginLogParams extends Partial<LoginLogRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
|
||||
export interface LoginLogListRes {
|
||||
list: LoginLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function queryLoginLogList(params: LoginLogParams) {
|
||||
return axios.get<LoginLogListRes>('/monitor/log/login', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
export interface OperationLogRecord {
|
||||
logId: string;
|
||||
description: string;
|
||||
status: number;
|
||||
clientIp: string;
|
||||
location: string;
|
||||
browser: string;
|
||||
errorMsg: string;
|
||||
createUserString: string;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
export interface OperationLogParams extends Partial<OperationLogRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
uid?: string;
|
||||
}
|
||||
|
||||
export interface OperationLogListRes {
|
||||
list: OperationLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function queryOperationLogList(params: OperationLogParams) {
|
||||
return axios.get<OperationLogListRes>('/monitor/log/operation', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
export interface SystemLogRecord {
|
||||
logId: string;
|
||||
statusCode: number;
|
||||
requestMethod: string;
|
||||
requestUrl: string;
|
||||
elapsedTime: number;
|
||||
clientIp: string;
|
||||
location: string;
|
||||
browser: string;
|
||||
errorMsg: string;
|
||||
exceptionDetail?: string;
|
||||
createUserString: string;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
export interface SystemLogParams extends Partial<SystemLogRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
|
||||
export interface SystemLogListRes {
|
||||
list: SystemLogRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function querySystemLogList(params: SystemLogParams) {
|
||||
return axios.get<SystemLogListRes>('/monitor/log/system', {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export interface SystemLogDetailRecord {
|
||||
logId: string;
|
||||
description: string;
|
||||
requestUrl: string;
|
||||
requestMethod: string;
|
||||
requestHeaders: string;
|
||||
requestBody: string;
|
||||
statusCode: number;
|
||||
responseHeaders: string;
|
||||
responseBody: string;
|
||||
elapsedTime: number;
|
||||
clientIp: string;
|
||||
location: string;
|
||||
browser: string;
|
||||
createUserString: string;
|
||||
createTime: string;
|
||||
}
|
||||
|
||||
export function querySystemLogDetail(logId: string) {
|
||||
return axios.get<SystemLogDetailRecord>(`/monitor/log/system/${logId}`);
|
||||
}
|
Reference in New Issue
Block a user