wip: 🚧 通知公告临时提交

通知公告临时提交,快结束了,css实在得学一波
This commit is contained in:
Theo
2024-09-08 02:21:58 +08:00
parent 6166c3d1bc
commit 9bb190f224
9 changed files with 275 additions and 502 deletions

View File

@@ -1,95 +0,0 @@
import request from "@/utils/request";
const NOTICESTATUS_BASE_URL = "/api/v1/noticeStatuss";
class NoticeStatusAPI {
/** 获取用户公告状态分页数据 */
static getPage(queryParams?: NoticeStatusPageQuery) {
return request<any, PageResult<NoticeStatusPageVO[]>>({
url: `${NOTICESTATUS_BASE_URL}/page`,
method: "get",
params: queryParams,
});
}
/**
* 获取用户公告状态表单数据
*
* @param id NoticeStatusID
* @returns NoticeStatus表单数据
*/
static getFormData(id: number) {
return request<any, NoticeStatusForm>({
url: `${NOTICESTATUS_BASE_URL}/${id}/form`,
method: "get",
});
}
/** 添加用户公告状态*/
static add(data: NoticeStatusForm) {
return request({
url: `${NOTICESTATUS_BASE_URL}`,
method: "post",
data: data,
});
}
/**
* 更新用户公告状态
*
* @param id NoticeStatusID
* @param data NoticeStatus表单数据
*/
static update(id: number, data: NoticeStatusForm) {
return request({
url: `${NOTICESTATUS_BASE_URL}/${id}`,
method: "put",
data: data,
});
}
/**
* 批量删除用户公告状态,多个以英文逗号(,)分割
*
* @param ids 用户公告状态ID字符串多个以英文逗号(,)分割
*/
static deleteByIds(ids: string) {
return request({
url: `${NOTICESTATUS_BASE_URL}/${ids}`,
method: "delete",
});
}
}
export default NoticeStatusAPI;
/** 用户公告状态分页查询参数 */
export interface NoticeStatusPageQuery extends PageQuery {
/** id */
id?: bigint;
/** 公共通知id */
noticeId?: bigint;
/** 用户id */
userId?: number;
/** 读取状态0未读1已读取 */
readStatus?: bigint;
/** 用户阅读时间 */
readTiem?: [string, string];
}
/** 用户公告状态表单对象 */
export interface NoticeStatusForm {}
/** 用户公告状态分页对象 */
export interface NoticeStatusPageVO {
/** id */
id?: bigint;
/** 公共通知id */
noticeId?: bigint;
/** 用户id */
userId?: number;
/** 读取状态0未读1已读取 */
readStatus?: bigint;
/** 用户阅读时间 */
readTiem?: Date;
}

View File

@@ -83,7 +83,7 @@ class NoticeAPI {
* @param id 撤回的通知id
* @returns
*/
static recallNotice(id: number) {
static recallNotice(id: number): Promise<[]> {
return request({
url: `${NOTICE_BASE_URL}/recall/${id}`,
method: "patch",
@@ -91,15 +91,47 @@ class NoticeAPI {
}
/**
* 获取我的通知公告n条
* 获取未读消息
* @returns 消息
*/
static listNotice() {
static listUnreadNotice() {
return request({
url: `${NOTICE_BASE_URL}/notice/5`,
url: `${NOTICE_BASE_URL}/unread`,
method: "get",
});
}
/**
* 查看通知
* @param id
*/
static readNotice(id: number): Promise<NoticeDetailVO> {
return request({
url: `${NOTICE_BASE_URL}/read/${id}`,
method: "PATCH",
});
}
/**
* 查看通知详情
* @param id
*/
static getDetail(id: number): Promise<NoticeDetailVO> {
return request({
url: `${NOTICE_BASE_URL}/detail/${id}`,
method: "get",
});
}
/**
* 全部已读
*/
static readAllNotice() {
return request({
url: `${NOTICE_BASE_URL}/readAll`,
method: "PATCH",
});
}
}
export default NoticeAPI;
@@ -151,3 +183,19 @@ export interface NoticePageVO {
/** 撤回时间 */
recallTime?: Date;
}
export interface NoticeDetailVO {
id?: string;
/** 通知标题 */
title?: string;
/** 通知内容 */
content?: string;
/** 通知类型 */
noticeTypeLabel?: number;
/** 发布人 */
releaseBy?: string;
/** 优先级(0-低 1-中 2-高) */
priority?: number;
/** 发布时间 */
releaseTime?: Date;
}

View File

@@ -5,7 +5,7 @@ const MAX_RETRIES = 3; // 最大重试次数
const RETRY_DELAY_MS = 5000; // 重试延迟时间,单位:毫秒
const HEARTBEAT_INTERVAL = 30000; // 心跳间隔时间,单位:毫秒
class WebSocketManager {
class Socket {
private clients: Map<string, Client> = new Map();
private retryCountMap: Map<string, number> = new Map();
private subscriptions: Map<string, ((message: string) => void)[]> = new Map();
@@ -110,4 +110,4 @@ class WebSocketManager {
}
}
export default new WebSocketManager();
export default new Socket();