mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-05 00:37:21 +08:00
feat(project): 添加vben5前端
This commit is contained in:
46
Yi.Vben5.Vue3/apps/web-antd/src/api/monitor/online/index.ts
Normal file
46
Yi.Vben5.Vue3/apps/web-antd/src/api/monitor/online/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { OnlineUser } from './model';
|
||||
|
||||
import type { IDS, PageQuery, PageResult } from '#/api/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
enum Api {
|
||||
root = '/online',
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前账号的在线设备 个人中心使用
|
||||
* @returns OnlineUser[]
|
||||
*/
|
||||
export function onlineDeviceList() {
|
||||
return requestClient.get<PageResult<OnlineUser>>(Api.root);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这里的分页参数无效 返回的是全部的分页
|
||||
* @param params 请求参数
|
||||
* @returns 结果
|
||||
*/
|
||||
export function onlineList(params?: PageQuery) {
|
||||
return requestClient.get<PageResult<OnlineUser>>(Api.root, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制下线
|
||||
* @param tokenId 连接Id
|
||||
* @returns void
|
||||
*/
|
||||
export function forceLogout(tokenId: IDS) {
|
||||
return requestClient.deleteWithMsg<void>(Api.root, {
|
||||
params: { ids: tokenId.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人中心用的 跟上面的不同是用的Post
|
||||
* @param tokenId 连接Id
|
||||
* @returns void
|
||||
*/
|
||||
export function forceLogout2(tokenId: string) {
|
||||
return requestClient.deleteWithMsg<void>(`${Api.root}/myself/${tokenId}`);
|
||||
}
|
||||
10
Yi.Vben5.Vue3/apps/web-antd/src/api/monitor/online/model.d.ts
vendored
Normal file
10
Yi.Vben5.Vue3/apps/web-antd/src/api/monitor/online/model.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export interface OnlineUser {
|
||||
connnectionId?: string;
|
||||
userId?: string;
|
||||
userName?: string;
|
||||
loginTime: number;
|
||||
ipaddr?: string;
|
||||
loginLocation?: string;
|
||||
os?: string;
|
||||
browser?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user