This commit is contained in:
beabigegg
2025-10-03 08:19:40 +08:00
commit 6599716481
99 changed files with 28184 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
import { request } from '@/utils/request'
/**
* 通知相關 API 服務
*/
export const notificationAPI = {
/**
* 獲取通知列表
* @param {Object} params - 查詢參數
* @param {number} params.page - 頁碼
* @param {number} params.per_page - 每頁數量
* @param {string} params.status - 狀態過濾 ('all', 'unread', 'read')
* @param {string} params.type - 類型過濾
*/
getNotifications(params = {}) {
return request.get('/notifications', { params })
},
/**
* 獲取單個通知詳情
* @param {string} notificationId - 通知ID
*/
getNotification(notificationId) {
return request.get(`/notifications/${notificationId}`)
},
/**
* 標記通知為已讀
* @param {string} notificationId - 通知ID
*/
markAsRead(notificationId) {
return request.post(`/notifications/${notificationId}/read`)
},
/**
* 標記所有通知為已讀
*/
markAllAsRead() {
return request.post('/notifications/read-all')
},
/**
* 刪除通知
* @param {string} notificationId - 通知ID
*/
deleteNotification(notificationId) {
return request.delete(`/notifications/${notificationId}`)
},
/**
* 清空所有已讀通知
*/
clearNotifications() {
return request.delete('/notifications/clear')
},
/**
* 創建測試通知(開發用)
*/
createTestNotification() {
return request.post('/notifications/test')
}
}