25 lines
717 B
JavaScript
25 lines
717 B
JavaScript
/**
|
|
* 消息通知 API — 获取列表、标记已读
|
|
*/
|
|
import { get, put } from "../utils/request";
|
|
|
|
/**
|
|
* 获取当前用户的通知列表
|
|
* @param {string} userId - 当前用户ID
|
|
* @param {number} skip - 分页偏移
|
|
* @param {number} limit - 每页条数
|
|
* @returns {Promise<{notifications: Array, total: number, unread_count: number}>}
|
|
*/
|
|
export function getNotifications(userId, skip = 0, limit = 20) {
|
|
return get("/notifications/", { user_id: userId, skip, limit });
|
|
}
|
|
|
|
/**
|
|
* 标记单条通知为已读
|
|
* @param {string} notificationId - 通知ID
|
|
* @returns {Promise<Object>}
|
|
*/
|
|
export function markNotificationRead(notificationId) {
|
|
return put(`/notifications/${notificationId}/read`);
|
|
}
|