message.ts 755 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import axios from 'axios';
  2. export interface MessageRecord {
  3. id: number;
  4. type: string;
  5. title: string;
  6. subTitle: string;
  7. avatar?: string;
  8. content: string;
  9. time: string;
  10. status: 0 | 1;
  11. messageType?: number;
  12. }
  13. export type MessageListType = MessageRecord[];
  14. export function queryMessageList() {
  15. return axios.post<MessageListType>('/api/message/list');
  16. }
  17. interface MessageStatus {
  18. ids: number[];
  19. }
  20. export function setMessageStatus(data: MessageStatus) {
  21. return axios.post<MessageListType>('/api/message/read', data);
  22. }
  23. export interface ChatRecord {
  24. id: number;
  25. username: string;
  26. content: string;
  27. time: string;
  28. isCollect: boolean;
  29. }
  30. export function queryChatList() {
  31. return axios.post<ChatRecord[]>('/api/chat/list');
  32. }