44 lines
796 B
JavaScript
44 lines
796 B
JavaScript
/**
|
|
* 消息通知API
|
|
*/
|
|
import request from '@/utils/request'
|
|
|
|
export default {
|
|
/**
|
|
* 获取消息列表
|
|
*/
|
|
getList(params) {
|
|
return request.get('/api/notification/list', params)
|
|
},
|
|
|
|
/**
|
|
* 获取未读消息数量
|
|
*/
|
|
getUnreadCount() {
|
|
const userInfo = uni.getStorageSync('userInfo')
|
|
const userId = userInfo?.id || userInfo?.userId
|
|
return request.get('/api/message/unread-count', { userId })
|
|
},
|
|
|
|
/**
|
|
* 标记消息为已读
|
|
*/
|
|
markRead(id) {
|
|
return request.post(`/api/notification/mark-read/${id}`)
|
|
},
|
|
|
|
/**
|
|
* 全部标记为已读
|
|
*/
|
|
markAllRead() {
|
|
return request.post('/api/notification/mark-all-read')
|
|
},
|
|
|
|
/**
|
|
* 删除消息
|
|
*/
|
|
delete(id) {
|
|
return request.delete(`/api/notification/${id}`)
|
|
}
|
|
}
|