39 lines
753 B
TypeScript
39 lines
753 B
TypeScript
import axios from 'axios';
|
|
|
|
export interface MessageRecord {
|
|
id: number;
|
|
type: string;
|
|
title: string;
|
|
subTitle: string;
|
|
avatar?: string;
|
|
content: string;
|
|
time: string;
|
|
status: 0 | 1;
|
|
messageType?: number;
|
|
}
|
|
export type MessageListType = MessageRecord[];
|
|
|
|
export function queryMessageList() {
|
|
return axios.get<MessageListType>('/api/message/list');
|
|
}
|
|
|
|
interface MessageStatus {
|
|
ids: number[];
|
|
}
|
|
|
|
export function setMessageStatus(data: MessageStatus) {
|
|
return axios.post<MessageListType>('/api/message/read', data);
|
|
}
|
|
|
|
export interface ChatRecord {
|
|
id: number;
|
|
username: string;
|
|
content: string;
|
|
time: string;
|
|
isCollect: boolean;
|
|
}
|
|
|
|
export function queryChatList() {
|
|
return axios.get<ChatRecord[]>('/api/chat/list');
|
|
}
|