59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import { get } from '../request'
|
|
|
|
export interface OperationLog {
|
|
id: string
|
|
user_id?: string
|
|
username?: string
|
|
module?: string
|
|
action?: string
|
|
target_type?: string
|
|
target_id?: string
|
|
target_name?: string
|
|
status: string
|
|
error_message?: string
|
|
error_type?: string
|
|
error_traceback?: string
|
|
func_name?: string
|
|
detail?: string
|
|
client_ip?: string
|
|
request_method?: string
|
|
request_path?: string
|
|
trace_id?: string
|
|
duration_ms?: number
|
|
create_time?: string
|
|
}
|
|
|
|
export interface OperationLogQuery {
|
|
user_id?: string
|
|
module?: string
|
|
action?: string
|
|
status?: string
|
|
keyword?: string
|
|
start_time?: string
|
|
end_time?: string
|
|
limit?: number
|
|
offset?: number
|
|
}
|
|
|
|
export interface OperationLogStats {
|
|
total: number
|
|
success: number
|
|
failure: number
|
|
failure_rate: number
|
|
module_failures: { module: string; count: number }[]
|
|
error_types: { type: string; count: number }[]
|
|
recent_errors: OperationLog[]
|
|
}
|
|
|
|
/** 操作日志查询 */
|
|
export const getOperationLogs = (query: OperationLogQuery = {}) =>
|
|
get<{ items: OperationLog[]; total: number }>('/system/operation-logs', query)
|
|
|
|
/** 操作日志统计 */
|
|
export const getOperationLogStats = (params?: { start_time?: string; end_time?: string }) =>
|
|
get<OperationLogStats>('/system/operation-logs/stats', params)
|
|
|
|
/** 获取操作日志中出现的模块列表 */
|
|
export const getOperationLogModules = () =>
|
|
get<{ value: string; label: string }[]>('/system/operation-logs/modules')
|