消息模块、爬虫
This commit is contained in:
@@ -58,7 +58,7 @@ export const aiAgentConfigApi = {
|
||||
* @returns Promise<ResultDomain<AiAgentConfig[]>>
|
||||
*/
|
||||
async listEnabledAgents(): Promise<ResultDomain<AiAgentConfig>> {
|
||||
const response = await api.get<AiAgentConfig>('/ai/agent/enabled', {
|
||||
const response = await api.get<AiAgentConfig>('/ai/agent/enabled',{}, {
|
||||
showLoading: false
|
||||
});
|
||||
return response.data;
|
||||
|
||||
@@ -85,8 +85,8 @@ request.interceptors.request.use(
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
const customConfig = config as CustomAxiosRequestConfig;
|
||||
|
||||
// 显示加载动画
|
||||
if (customConfig.showLoading !== false) {
|
||||
// 默认不显示加载动画,只有显式开启时才展示
|
||||
if (customConfig.showLoading) {
|
||||
loadingInstance = ElLoading.service({
|
||||
lock: true,
|
||||
text: "加载中...",
|
||||
|
||||
7
schoolNewsWeb/src/apis/message/index.ts
Normal file
7
schoolNewsWeb/src/apis/message/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @description 消息通知API导出
|
||||
* @author Claude
|
||||
* @since 2025-11-13
|
||||
*/
|
||||
|
||||
export * from './message';
|
||||
216
schoolNewsWeb/src/apis/message/message.ts
Normal file
216
schoolNewsWeb/src/apis/message/message.ts
Normal file
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* @description 消息通知相关API
|
||||
* @author Claude
|
||||
* @since 2025-11-13
|
||||
*/
|
||||
|
||||
import { api } from '@/apis/index';
|
||||
import type {
|
||||
TbSysMessage,
|
||||
TbSysMessageUser,
|
||||
MessageVO,
|
||||
MessageUserVO,
|
||||
ResultDomain,
|
||||
PageParam,
|
||||
PageRequest
|
||||
} from '@/types';
|
||||
|
||||
/**
|
||||
* 消息API服务
|
||||
*/
|
||||
export const messageApi = {
|
||||
/**
|
||||
* @description 创建消息
|
||||
* @param message 消息对象
|
||||
* @returns Promise<ResultDomain<TbSysMessage>>
|
||||
*/
|
||||
async createMessage(message: TbSysMessage): Promise<ResultDomain<TbSysMessage>> {
|
||||
const response = await api.post<TbSysMessage>('/message', message);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 更新消息
|
||||
* @param messageIDOrMessage 消息ID 或 完整消息对象
|
||||
* @param messageData 消息数据(当第一个参数为ID时使用)
|
||||
* @returns Promise<ResultDomain<TbSysMessage>>
|
||||
*/
|
||||
async updateMessage(message: TbSysMessage): Promise<ResultDomain<TbSysMessage>> {
|
||||
const response = await api.put<TbSysMessage>(`/message`, message);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 删除消息
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async deleteMessage(messageID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`/message/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取消息分页列表(管理端)
|
||||
* @param pageRequest 分页请求对象
|
||||
* @returns Promise<ResultDomain<MessageVO>>
|
||||
*/
|
||||
async getMessagePage(pageRequest: PageRequest<TbSysMessage>): Promise<ResultDomain<MessageVO>> {
|
||||
const response = await api.post<MessageVO>('/message/page', pageRequest);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取消息详情(管理端)
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<MessageVO>>
|
||||
*/
|
||||
async getMessage(messageID: string): Promise<ResultDomain<MessageVO>> {
|
||||
return this.getMessageDetail(messageID);
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取消息详情(管理端)
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<MessageVO>>
|
||||
*/
|
||||
async getMessageDetail(messageID: string): Promise<ResultDomain<MessageVO>> {
|
||||
const response = await api.get<MessageVO>(`/message/detail/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 立即发送消息
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<TbSysMessage>>
|
||||
*/
|
||||
async sendMessage(messageID: string): Promise<ResultDomain<TbSysMessage>> {
|
||||
const response = await api.post<TbSysMessage>(`/message/send/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 立即发送(将定时消息改为立即发送)
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<TbSysMessage>>
|
||||
*/
|
||||
async sendNow(messageID: string): Promise<ResultDomain<TbSysMessage>> {
|
||||
const response = await api.post<TbSysMessage>(`/message/sendNow/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 取消定时消息
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<TbSysMessage>>
|
||||
*/
|
||||
async cancelMessage(messageID: string): Promise<ResultDomain<TbSysMessage>> {
|
||||
const response = await api.post<TbSysMessage>(`/message/cancel/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 重新安排定时消息时间
|
||||
* @param messageID 消息ID
|
||||
* @param newScheduledTime 新的定时发送时间
|
||||
* @returns Promise<ResultDomain<TbSysMessage>>
|
||||
*/
|
||||
async rescheduleMessage(messageID: string, newScheduledTime: string): Promise<ResultDomain<TbSysMessage>> {
|
||||
const response = await api.put<TbSysMessage>(`/message/reschedule/${messageID}`, {
|
||||
scheduledTime: newScheduledTime
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 重试发送失败的消息
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<TbSysMessage>>
|
||||
*/
|
||||
async retryMessage(messageID: string): Promise<ResultDomain<TbSysMessage>> {
|
||||
const response = await api.post<TbSysMessage>(`/message/retry/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取当前用户的消息列表(用户端)
|
||||
* @param pageParam 分页参数
|
||||
* @param filter 过滤条件
|
||||
* @returns Promise<ResultDomain<MessageUserVO>>
|
||||
*/
|
||||
async getMyMessages(pageParam: PageParam, filter?: TbSysMessageUser): Promise<ResultDomain<MessageUserVO>> {
|
||||
const response = await api.post<MessageUserVO>('/message/my/page', {
|
||||
pageParam,
|
||||
filter
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取当前用户的消息详情(用户端)
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<MessageUserVO>>
|
||||
*/
|
||||
async getMyMessageDetail(messageID: string): Promise<ResultDomain<MessageUserVO>> {
|
||||
const response = await api.get<MessageUserVO>(`/message/my/detail/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 标记消息为已读
|
||||
* @param messageID 消息ID
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async markAsRead(messageID: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.post<boolean>(`/message/my/markRead/${messageID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 批量标记消息为已读
|
||||
* @param messageIDs 消息ID列表
|
||||
* @returns Promise<ResultDomain<boolean>>
|
||||
*/
|
||||
async batchMarkAsRead(messageIDs: string[]): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.post<boolean>('/message/my/batchMarkRead', { messageIDs });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取未读消息数量
|
||||
* @returns Promise<ResultDomain<number>>
|
||||
*/
|
||||
async getUnreadCount(): Promise<ResultDomain<number>> {
|
||||
const response = await api.get<number>('/message/my/unreadCount');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取可选择的部门列表(当前部门及子部门)
|
||||
* @returns Promise<ResultDomain<any>>
|
||||
*/
|
||||
async getTargetDepts(): Promise<ResultDomain<any>> {
|
||||
const response = await api.get<any>('/message/targets/depts');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取可选择的角色列表(指定部门范围内的角色)
|
||||
* @param scopeDeptID 作用域部门ID
|
||||
* @returns Promise<ResultDomain<any>>
|
||||
*/
|
||||
async getTargetRoles(scopeDeptID: string): Promise<ResultDomain<any>> {
|
||||
const response = await api.get<any>(`/message/targets/roles?scopeDeptID=${scopeDeptID}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @description 获取可选择的用户列表(指定部门范围内的用户)
|
||||
* @param scopeDeptID 作用域部门ID
|
||||
* @returns Promise<ResultDomain<any>>
|
||||
*/
|
||||
async getTargetUsers(scopeDeptID: string): Promise<ResultDomain<any>> {
|
||||
const response = await api.get<any>(`/message/targets/users?scopeDeptID=${scopeDeptID}`);
|
||||
return response.data;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user