add Notify
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
import { axios } from "./BaseAPI";
|
||||||
|
import type { NotifyDetail, Page, PageResult } from "../types";
|
||||||
|
|
||||||
|
const BASE_URI = "/notify/internal";
|
||||||
|
|
||||||
|
/** 查询当前用户的站内通知。 */
|
||||||
|
async function listInternal(page?: Page<NotifyDetail>, unreadOnly = false): Promise<PageResult<NotifyDetail>> {
|
||||||
|
return await axios.post(`${BASE_URI}/internal`, page, {
|
||||||
|
params: { unreadOnly }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询当前用户未读站内通知数量。 */
|
||||||
|
async function countUnreadInternal(): Promise<number> {
|
||||||
|
return await axios.post(`${BASE_URI}/unread/count`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 标记当前用户的一条站内通知已读。 */
|
||||||
|
async function markInternalRead(id: string): Promise<void> {
|
||||||
|
await axios.post(`${BASE_URI}/read`, undefined, {
|
||||||
|
params: { id }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 标记当前用户全部站内通知已读。 */
|
||||||
|
async function markAllInternalRead(): Promise<void> {
|
||||||
|
await axios.post(`${BASE_URI}/read/all`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
listInternal,
|
||||||
|
countUnreadInternal,
|
||||||
|
markInternalRead,
|
||||||
|
markAllInternalRead
|
||||||
|
};
|
||||||
@@ -3,6 +3,7 @@ export { default as AttachmentAPI } from "./AttachmentAPI";
|
|||||||
export { default as CommentAPI } from "./CommentAPI";
|
export { default as CommentAPI } from "./CommentAPI";
|
||||||
export { default as CommonAPI } from "./CommonAPI";
|
export { default as CommonAPI } from "./CommonAPI";
|
||||||
export { default as DeveloperAPI } from "./DeveloperAPI";
|
export { default as DeveloperAPI } from "./DeveloperAPI";
|
||||||
|
export { default as NotifyAPI } from "./NotifyAPI";
|
||||||
export { default as PermissionAPI } from "./PermissionAPI";
|
export { default as PermissionAPI } from "./PermissionAPI";
|
||||||
export { default as RoleAPI } from "./RoleAPI";
|
export { default as RoleAPI } from "./RoleAPI";
|
||||||
export { default as UserAPI } from "./UserAPI";
|
export { default as UserAPI } from "./UserAPI";
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import type { Model } from "./Model";
|
||||||
|
|
||||||
|
/** 通知消息类型 */
|
||||||
|
export type NotifyMsgType = "INTERNAL" | "SMS" | "MAIL" | "HTTP" | "WECHAT";
|
||||||
|
|
||||||
|
/** 通知投递状态 */
|
||||||
|
export type NotifyStatus = "WAITING" | "REMINDED" | "TIMEOUT" | "CANCEL" | "FAIL";
|
||||||
|
|
||||||
|
/** 通知 */
|
||||||
|
export type Notify = {
|
||||||
|
/** 业务类型 */
|
||||||
|
bizType?: string;
|
||||||
|
/** 提醒业务类型 */
|
||||||
|
bizRemindedType?: string;
|
||||||
|
/** 提醒业务 ID */
|
||||||
|
bizRemindedId?: string;
|
||||||
|
/** 参数 */
|
||||||
|
args?: string;
|
||||||
|
/** 创建者 */
|
||||||
|
createdBy?: string;
|
||||||
|
/** 通知详情列表 */
|
||||||
|
detailList?: NotifyDetail[];
|
||||||
|
} & Model;
|
||||||
|
|
||||||
|
/** 通知详情 */
|
||||||
|
export type NotifyDetail = {
|
||||||
|
/** 所属通知 ID */
|
||||||
|
notifyId?: string;
|
||||||
|
/** 消息类型 */
|
||||||
|
msgType?: NotifyMsgType;
|
||||||
|
/** 模板 ID */
|
||||||
|
templateId?: string;
|
||||||
|
/** 标题 */
|
||||||
|
subject?: string;
|
||||||
|
/** 内容 */
|
||||||
|
data?: string;
|
||||||
|
/** 参数 */
|
||||||
|
args?: string;
|
||||||
|
/** 发送来源 */
|
||||||
|
sendFrom?: string;
|
||||||
|
/** 发送去向 */
|
||||||
|
sendTo?: string;
|
||||||
|
/** 发送时间 */
|
||||||
|
sendAt?: number;
|
||||||
|
/** 重试计数 */
|
||||||
|
retry?: number;
|
||||||
|
/** 超时时间 */
|
||||||
|
timeoutAt?: number;
|
||||||
|
/** 结果描述 */
|
||||||
|
resultDesc?: string;
|
||||||
|
/** 投递状态 */
|
||||||
|
status?: NotifyStatus;
|
||||||
|
/** 已读时间,站内通知未读时为空 */
|
||||||
|
readAt?: number;
|
||||||
|
/** 所属通知 */
|
||||||
|
notify?: Notify;
|
||||||
|
} & Model;
|
||||||
@@ -10,6 +10,7 @@ export * from "./Role";
|
|||||||
export * from "./User";
|
export * from "./User";
|
||||||
export * from "./Comment";
|
export * from "./Comment";
|
||||||
export * from "./Developer";
|
export * from "./Developer";
|
||||||
|
export * from "./Notify";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装方法
|
* 安装方法
|
||||||
|
|||||||
Reference in New Issue
Block a user