import httpService from "./httpService"; import type { ApiResponse } from "./httpService"; export enum ReadStatus { UNREAD = 0, READ = 1 } export interface NoticeListParams { notification_type?: string; is_read?: ReadStatus; } export interface NoticeListResponse { list: any[]; total: number; unread_count: number; } export interface Notice { description: string; } export interface MarkReadParams { notification_ids: number[]; mark_all: boolean; } export interface DeleteParams { notification_ids: number[]; delete_all: boolean; } export interface UnreadMountResponse { total_unread: number; unread_by_type: {} } class NoticeService { // 获取用户消息通知列表 async getNotificationList({ notification_type, is_read }: NoticeListParams): Promise> { return httpService.post("/notifications/list", { notification_type, is_read }, { showLoading: false }); } // 获取消息通知详情 async getNotificationDetail(notification_id: number): Promise> { return httpService.post("/notifications/detail", { notification_id }, { showLoading: false }); } // 标记消息为已读 async markNotificationRead({ notification_ids, mark_all }: MarkReadParams): Promise> { return httpService.post("/notifications/mark_read", { notification_ids, mark_all }, { showLoading: false }); } // 删除消息通知 async delNotification({ notification_ids, delete_all }: DeleteParams): Promise> { return httpService.post("/notifications/delete", { notification_ids, delete_all }, { showLoading: false }); } // 获取未读消息数量 async getNotificationUnreadCount(): Promise> { return httpService.post("/notifications/unread_count", {}, { showLoading: false }); } } export default new NoticeService();