45 lines
941 B
JavaScript
45 lines
941 B
JavaScript
/**
|
|
* 消息相关 API
|
|
*/
|
|
|
|
import { get, post } from './request.js'
|
|
|
|
/**
|
|
* 获取系统消息列表
|
|
* @param {Object} params - 查询参数
|
|
* @param {number} params.pageIndex - 页码
|
|
* @param {number} params.pageSize - 每页数量
|
|
* @returns {Promise}
|
|
*/
|
|
export const getSystemMessages = (params) => {
|
|
return get('/notification/list', {
|
|
pageIndex: params.pageIndex,
|
|
pageSize: params.pageSize
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 标记消息已读
|
|
* @param {number} messageId - 消息ID
|
|
* @returns {Promise}
|
|
*/
|
|
export const markMessageRead = (messageId) => {
|
|
return post('/notification/read', { notificationId: messageId })
|
|
}
|
|
|
|
/**
|
|
* 标记所有系统消息已读
|
|
* @returns {Promise}
|
|
*/
|
|
export const markAllSystemMessagesRead = () => {
|
|
return post('/notification/read', { markAll: true })
|
|
}
|
|
|
|
/**
|
|
* 获取未读消息数量
|
|
* @returns {Promise}
|
|
*/
|
|
export const getUnreadCount = () => {
|
|
return get('/notification/unreadCount')
|
|
}
|