feat: 登录日志(demo)

This commit is contained in:
dap
2024-09-12 09:51:59 +08:00
parent 3987c9e876
commit 45ed89c25f
8 changed files with 314 additions and 7 deletions

View File

@@ -0,0 +1,60 @@
import type { LoginLog } from './model';
import type { IDS, PageQuery, PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
enum Api {
loginInfoClean = '/monitor/logininfor/clean',
loginInfoExport = '/monitor/logininfor/export',
loginInfoList = '/monitor/logininfor/list',
root = '/monitor/logininfor',
userUnlock = '/monitor/logininfor/unlock',
}
/**
* 登录日志列表
* @param params 查询参数
* @returns list[]
*/
export function loginInfoList(params?: PageQuery) {
return requestClient.get<PageResult<LoginLog>>(Api.loginInfoList, { params });
}
/**
* 导出登录日志
* @param data 表单参数
* @returns excel
*/
export function loginInfoExport(data: any) {
return commonExport(Api.loginInfoExport, data);
}
/**
* 移除登录日志
* @param infoIds 登录日志id数组
* @returns void
*/
export function loginInfoRemove(infoIds: IDS) {
return requestClient.deleteWithMsg<void>(`${Api.root}/${infoIds.join(',')}`);
}
/**
* 账号解锁
* @param username 用户名(账号)
* @returns void
*/
export function userUnlock(username: string) {
return requestClient.get<void>(`${Api.userUnlock}/${username}`, {
successMessageMode: 'message',
});
}
/**
* 清空全部登录日志
* @returns void
*/
export function loginInfoClean() {
return requestClient.deleteWithMsg<void>(Api.loginInfoClean);
}

View File

@@ -0,0 +1,12 @@
export interface LoginLog {
infoId: string;
tenantId: string;
userName: string;
status: string;
ipaddr: string;
loginLocation: string;
browser: string;
os: string;
msg: string;
loginTime: string;
}