feat:增加 api 访问日志、错误日志
This commit is contained in:
42
apps/web-antd/src/api/infra/api-access-log/index.ts
Normal file
42
apps/web-antd/src/api/infra/api-access-log/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InfraApiAccessLogApi {
|
||||
/** API 访问日志信息 */
|
||||
export interface SystemApiAccessLog {
|
||||
id: number;
|
||||
traceId: string;
|
||||
userId: number;
|
||||
userType: number;
|
||||
applicationName: string;
|
||||
requestMethod: string;
|
||||
requestParams: string;
|
||||
responseBody: string;
|
||||
requestUrl: string;
|
||||
userIp: string;
|
||||
userAgent: string;
|
||||
operateModule: string;
|
||||
operateName: string;
|
||||
operateType: number;
|
||||
beginTime: string;
|
||||
endTime: string;
|
||||
duration: number;
|
||||
resultCode: number;
|
||||
resultMsg: string;
|
||||
createTime: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询 API 访问日志列表 */
|
||||
export function getApiAccessLogPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<InfraApiAccessLogApi.SystemApiAccessLog>>(
|
||||
'/infra/api-access-log/page',
|
||||
{ params }
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出 API 访问日志 */
|
||||
export function exportApiAccessLog(params: any) {
|
||||
return requestClient.download('/infra/api-access-log/export-excel', { params });
|
||||
}
|
||||
51
apps/web-antd/src/api/infra/api-error-log/index.ts
Normal file
51
apps/web-antd/src/api/infra/api-error-log/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InfraApiErrorLogApi {
|
||||
/** API 错误日志信息 */
|
||||
export interface SystemApiErrorLog {
|
||||
id: number;
|
||||
traceId: string;
|
||||
userId: number;
|
||||
userType: number;
|
||||
applicationName: string;
|
||||
requestMethod: string;
|
||||
requestParams: string;
|
||||
requestUrl: string;
|
||||
userIp: string;
|
||||
userAgent: string;
|
||||
exceptionTime: string;
|
||||
exceptionName: string;
|
||||
exceptionMessage: string;
|
||||
exceptionRootCauseMessage: string;
|
||||
exceptionStackTrace: string;
|
||||
exceptionClassName: string;
|
||||
exceptionFileName: string;
|
||||
exceptionMethodName: string;
|
||||
exceptionLineNumber: number;
|
||||
processUserId: number;
|
||||
processStatus: number;
|
||||
processTime: string;
|
||||
resultCode: number;
|
||||
createTime: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询 API 错误日志列表 */
|
||||
export function getApiErrorLogPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<InfraApiErrorLogApi.SystemApiErrorLog>>(
|
||||
'/infra/api-error-log/page',
|
||||
{ params }
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新 API 错误日志的处理状态 */
|
||||
export function updateApiErrorLogStatus(id: number, processStatus: number) {
|
||||
return requestClient.put(`/infra/api-error-log/update-status?id=${id}&processStatus=${processStatus}`);
|
||||
}
|
||||
|
||||
/** 导出 API 错误日志 */
|
||||
export function exportApiErrorLog(params: any) {
|
||||
return requestClient.download('/infra/api-error-log/export-excel', { params });
|
||||
}
|
||||
@@ -2,19 +2,19 @@ import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemPermissionApi {
|
||||
/** 分配用户角色请求 */
|
||||
export interface AssignUserRoleReqVO {
|
||||
export interface SystemAssignUserRoleReqVO {
|
||||
userId: number;
|
||||
roleIds: number[];
|
||||
}
|
||||
|
||||
/** 分配角色菜单请求 */
|
||||
export interface AssignRoleMenuReqVO {
|
||||
export interface SystemAssignRoleMenuReqVO {
|
||||
roleId: number;
|
||||
menuIds: number[];
|
||||
}
|
||||
|
||||
/** 分配角色数据权限请求 */
|
||||
export interface AssignRoleDataScopeReqVO {
|
||||
export interface SystemAssignRoleDataScopeReqVO {
|
||||
roleId: number;
|
||||
dataScope: number;
|
||||
dataScopeDeptIds: number[];
|
||||
@@ -30,14 +30,14 @@ export async function getRoleMenuList(roleId: number) {
|
||||
|
||||
/** 赋予角色菜单权限 */
|
||||
export async function assignRoleMenu(
|
||||
data: SystemPermissionApi.AssignRoleMenuReqVO,
|
||||
data: SystemPermissionApi.SystemAssignRoleMenuReqVO,
|
||||
) {
|
||||
return requestClient.post('/system/permission/assign-role-menu', data);
|
||||
}
|
||||
|
||||
/** 赋予角色数据权限 */
|
||||
export async function assignRoleDataScope(
|
||||
data: SystemPermissionApi.AssignRoleDataScopeReqVO,
|
||||
data: SystemPermissionApi.SystemAssignRoleDataScopeReqVO,
|
||||
) {
|
||||
return requestClient.post('/system/permission/assign-role-data-scope', data);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export async function getUserRoleList(userId: number) {
|
||||
|
||||
/** 赋予用户角色 */
|
||||
export async function assignUserRole(
|
||||
data: SystemPermissionApi.AssignUserRoleReqVO,
|
||||
data: SystemPermissionApi.SystemAssignUserRoleReqVO,
|
||||
) {
|
||||
return requestClient.post('/system/permission/assign-user-role', data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user