| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import axiosInstance from '../../utils/axios';
- import { PageParam, PageResponse } from '../user';
- // 站内信消息类型
- export interface NotifyMessageVO {
- id: number;
- userId: number;
- userType: number;
- templateId?: number;
- templateCode?: string;
- templateNickname?: string;
- templateContent?: string;
- templateParams?: any;
- templateType?: number;
- title: string;
- createTime?: number | string; // 创建时间(时间戳或字符串)
- readStatus?: boolean; // 是否已读
- readTime?: number | string; // 阅读时间(时间戳或字符串)
- }
- // App通知查询参数
- export interface NotifyMessageQueryParams extends PageParam {
- readStatus?: boolean; // 是否已读,示例值(true)
- title?: string; // 标题,示例值(true)
- 'createTime[0]'?: string; // 开始日期时间:格式 YYYY-MM-DD 00:00:00
- 'createTime[1]'?: string; // 结束日期时间:格式 YYYY-MM-DD 23:59:59
- type?: number; // 类型(0-站内信 1-app消息),示例值(1)
- [key: string]: any; // 允许动态添加其他参数
- }
- // 发送站内信参数
- export interface SendNotifyMessageVO {
- title: string; // 消息标题
- content: string; // 消息内容
- type?: string; // 消息类型
- userIds?: number[]; // 接收用户ID列表
- deptIds?: number[]; // 接收部门ID列表
- roleIds?: number[]; // 接收角色ID列表
- }
- // App 通知 API
- export const app_message = {
- // 获取我的 App 通知列表(分页)
- getMyPage: (params?: NotifyMessageQueryParams): Promise<PageResponse<NotifyMessageVO>> => {
- return axiosInstance.get('/system/app-notify-message/my-page', { params });
- },
- // 标记消息为已读
- updateRead: (ids: number[]): Promise<void> => {
- const idsParam = ids.join(',');
- return axiosInstance.put(`/system/app-notify-message/update-read?ids=${idsParam}`);
- },
- // 全部标记为已读
- updateAllRead: (): Promise<void> => {
- return axiosInstance.put('/system/app-notify-message/update-all-read');
- },
- };
|