feat(API): 新增在线用户监控API模块
- 新增在线用户相关类型定义 - 实现分页查询在线用户列表接口 - 实现强制注销用户接口 - 实现获取在线用户统计接口 - 支持按登录名、用户名、IP地址过滤
This commit is contained in:
parent
99ef1f1f61
commit
27f9622b17
33
src/service/api/monitor/online/index.ts
Normal file
33
src/service/api/monitor/online/index.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { request } from '@/service/http'
|
||||||
|
import type {
|
||||||
|
OnlineUserCountVo,
|
||||||
|
OnlineUserSearchForm,
|
||||||
|
OnlineUserVo,
|
||||||
|
PageOnlineUserVo,
|
||||||
|
SysUserOnlineQueryBo,
|
||||||
|
} from './types'
|
||||||
|
|
||||||
|
// 重新导出类型定义
|
||||||
|
export type { OnlineUserCountVo, OnlineUserSearchForm, OnlineUserVo, PageOnlineUserVo, SysUserOnlineQueryBo }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询在线用户列表
|
||||||
|
*/
|
||||||
|
export function getOnlineUserListPage(params: SysUserOnlineQueryBo) {
|
||||||
|
return request.Get<Service.ResponseResult<PageOnlineUserVo>>('/coder/sysUserOnline/listPage', { params })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制注销
|
||||||
|
* @param userId 用户ID
|
||||||
|
*/
|
||||||
|
export function logoutUser(userId: string) {
|
||||||
|
return request.Get<Service.ResponseResult<string>>(`/coder/sysUserOnline/logout/${userId}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取在线用户统计信息
|
||||||
|
*/
|
||||||
|
export function getOnlineUserCount() {
|
||||||
|
return request.Get<Service.ResponseResult<OnlineUserCountVo>>('/coder/sysUserOnline/count')
|
||||||
|
}
|
||||||
97
src/service/api/monitor/online/types.ts
Normal file
97
src/service/api/monitor/online/types.ts
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* 在线用户监控 - 类型定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户实体
|
||||||
|
*/
|
||||||
|
export interface OnlineUserVo {
|
||||||
|
/** 用户ID */
|
||||||
|
userId: string
|
||||||
|
/** 登录名称 */
|
||||||
|
loginName: string
|
||||||
|
/** 用户名 */
|
||||||
|
userName: string
|
||||||
|
/** 用户头像 */
|
||||||
|
avatar?: string
|
||||||
|
/** 性别[1-男 2-女 3-未知] */
|
||||||
|
sex?: string
|
||||||
|
/** 手机号 */
|
||||||
|
phone?: string
|
||||||
|
/** 邮箱 */
|
||||||
|
email?: string
|
||||||
|
/** 用户类型[1-系统用户 2-注册用户 3-微信用户] */
|
||||||
|
userType?: string
|
||||||
|
/** 城市ID[可新增城市表-暂时无用] */
|
||||||
|
cityId?: string
|
||||||
|
/** 登录时间 */
|
||||||
|
loginTime?: string
|
||||||
|
/** 创建时间 */
|
||||||
|
createTime?: string
|
||||||
|
/** 登录IP */
|
||||||
|
loginIp?: string
|
||||||
|
/** 登录地址 */
|
||||||
|
loginAddress?: string
|
||||||
|
/** 浏览器类型 */
|
||||||
|
browser?: string
|
||||||
|
/** 操作系统 */
|
||||||
|
os?: string
|
||||||
|
/** 设备名字 */
|
||||||
|
deviceName?: string
|
||||||
|
/** 是否超级管理员 */
|
||||||
|
isCoderAdmin?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户查询参数
|
||||||
|
*/
|
||||||
|
export interface SysUserOnlineQueryBo {
|
||||||
|
/** 页码 */
|
||||||
|
pageNo?: number
|
||||||
|
/** 页大小 */
|
||||||
|
pageSize?: number
|
||||||
|
/** 登录名称 */
|
||||||
|
loginName?: string
|
||||||
|
/** 用户名字 */
|
||||||
|
userName?: string
|
||||||
|
/** IP地址 */
|
||||||
|
loginIp?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户搜索表单
|
||||||
|
*/
|
||||||
|
export interface OnlineUserSearchForm {
|
||||||
|
/** 登录名称 */
|
||||||
|
loginName?: string
|
||||||
|
/** 用户名字 */
|
||||||
|
userName?: string
|
||||||
|
/** IP地址 */
|
||||||
|
loginIp?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页在线用户响应
|
||||||
|
*/
|
||||||
|
export interface PageOnlineUserVo {
|
||||||
|
/** 总记录数 */
|
||||||
|
total: number
|
||||||
|
/** 当前页 */
|
||||||
|
current: number
|
||||||
|
/** 每页大小 */
|
||||||
|
size: number
|
||||||
|
/** 总页数 */
|
||||||
|
pages: number
|
||||||
|
/** 数据列表 */
|
||||||
|
records: OnlineUserVo[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线用户统计响应
|
||||||
|
*/
|
||||||
|
export interface OnlineUserCountVo {
|
||||||
|
/** 在线用户总数 */
|
||||||
|
onlineCount: number
|
||||||
|
/** 统计时间戳 */
|
||||||
|
timestamp: number
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user