Quellcode durchsuchen

add: api-log model & service

dev
powersir vor 1 Jahr
Ursprung
Commit
540066c20b
5 geänderte Dateien mit 125 neuen und 0 gelöschten Zeilen
  1. +83
    -0
      src/models/api-log.data.ts
  2. +1
    -0
      src/models/index.ts
  3. +0
    -0
      src/pages/infra/log/api-access-log/index.tsx
  4. +0
    -0
      src/pages/infra/log/api-error-log/index.tsx
  5. +41
    -0
      src/request/service/api-log.ts

+ 83
- 0
src/models/api-log.data.ts Datei anzeigen

@@ -0,0 +1,83 @@
export interface ApiAccessLogVO {
id: number
traceId: string
userId: number
userType: number
applicationName: string
requestMethod: string
requestParams: string
requestUrl: string
userIp: string
userAgent: string
beginTime: Date
endTIme: Date
duration: number
resultCode: number
resultMsg: string
createTime: Date
}

export interface ApiAccessLogPageReqVO extends PageParam {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
beginTime?: Date[]
duration?: number
resultCode?: number
}

export interface ApiAccessLogExportReqVO {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
beginTime?: Date[]
duration?: number
resultCode?: number
}

export interface ApiErrorLogVO {
id: number
traceId: string
userId: number
userType: number
applicationName: string
requestMethod: string
requestParams: string
requestUrl: string
userIp: string
userAgent: string
exceptionTime: Date
exceptionName: string
exceptionMessage: string
exceptionRootCauseMessage: string
exceptionStackTrace: string
exceptionClassName: string
exceptionFileName: string
exceptionMethodName: string
exceptionLineNumber: number
processUserId: number
processStatus: number
processTime: Date
resultCode: number
createTime: Date
}

export interface ApiErrorLogPageReqVO extends PageParam {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
exceptionTime?: Date[]
processStatus: number
}

export interface ApiErrorLogExportReqVO {
userId?: number
userType?: number
applicationName?: string
requestUrl?: string
exceptionTime?: Date[]
processStatus: number
}

+ 1
- 0
src/models/index.ts Datei anzeigen

@@ -9,6 +9,7 @@ export * from './platform-product.data.ts'
export * from './system-dict.data.ts'
export * from './error-code.data.ts'
export * from './redis.data.ts'
export * from './api-log.data.ts'

export interface ResponseDTO<T>{
code: number;


+ 0
- 0
src/pages/infra/log/api-access-log/index.tsx Datei anzeigen


+ 0
- 0
src/pages/infra/log/api-error-log/index.tsx Datei anzeigen


+ 41
- 0
src/request/service/api-log.ts Datei anzeigen

@@ -0,0 +1,41 @@
import request from '@/request';
import {
ApiErrorLogPageReqVO,
ApiErrorLogExportReqVO,
ApiErrorLogVO,
ApiAccessLogPageReqVO,
ApiAccessLogExportReqVO,
ApiAccessLogVO,
PageData
} from '@/models';

const BASE_URL = '/admin-api/infra/api-error-log';
const BASE_ACCESS_URL = '/admin-api/infra/api-access-log'

export default {
// 查询列表API 访问日志
getApiErrorLogPageApi: (params: ApiErrorLogPageReqVO) => {
return request.get<PageData<ApiErrorLogVO>>(`${BASE_URL}/page`, { params })
},

// 更新 API 错误日志的处理状态
updateApiErrorLogPageApi: (id: number, processStatus: number) => {
return request.put(`${BASE_URL}/update-status?id=${id}&processStatus=${processStatus}`)
},

// 导出API 访问日志
exportApiErrorLogApi: (params: ApiErrorLogExportReqVO) => {
return request.get(`${BASE_URL}/export-excel`, { params, responseType: 'blob' })
},


// 查询列表API 访问日志
getApiAccessLogPageApi: (params: ApiAccessLogPageReqVO) => {
return request.get<PageData<ApiAccessLogVO>>(`${BASE_ACCESS_URL}/page`, { params })
},

// 导出API 访问日志
exportApiAccessLogApi: (params: ApiAccessLogExportReqVO) => {
return request.get(`${BASE_ACCESS_URL}/export-excel`, { params, responseType: 'blob' })
}
}

Laden…
Abbrechen
Speichern