52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
|
import axios from 'axios';
|
||
|
|
||
|
export interface MessageRecord {
|
||
|
userId?: string;
|
||
|
title?: string;
|
||
|
type?: string;
|
||
|
name?: string;
|
||
|
system?: boolean;
|
||
|
isRead?: boolean;
|
||
|
createAtBegin?: string;
|
||
|
createAtEnd?: string;
|
||
|
current: number;
|
||
|
size: number;
|
||
|
}
|
||
|
|
||
|
export interface MessageCreateRecord {
|
||
|
userId: string[];
|
||
|
type: string;
|
||
|
email: string;
|
||
|
sms: string;
|
||
|
html: string;
|
||
|
title: string;
|
||
|
content: string;
|
||
|
attachmentIds?: string[];
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
// 查看详情
|
||
|
export function queryMessage(userId: number, messageId: number) {
|
||
|
return axios.get(`/api/rest/message/${userId}/${messageId}`);
|
||
|
}
|
||
|
// 分页查询
|
||
|
export function queryMessageList(data: MessageRecord) {
|
||
|
return axios({
|
||
|
url: '/api/rest/message',
|
||
|
method: 'get',
|
||
|
params: data,
|
||
|
});
|
||
|
}
|
||
|
// 创建消息
|
||
|
export function createMessage(data: MessageCreateRecord) {
|
||
|
return axios.post('/api/rest/message', data);
|
||
|
}
|
||
|
// 获取消息推送方式
|
||
|
export function getMessageTypes() {
|
||
|
return axios.get('/api/rest/message/setting');
|
||
|
}
|
||
|
// 设置消息推送方式
|
||
|
export function setMessageTypes(data: string[]) {
|
||
|
return axios.patch('/api/rest/message/setting', data);
|
||
|
}
|