Notifications 通知管理
共 5 个接口 · 路由前缀 /api/admin
基础信息
- Base URL:
/api/admin - 认证方式: JWT Bearer Token
数据库表
notifications— 通知表users— 用户表(LEFT JOIN 获取用户昵称)
接口列表
1. 获取通知列表(分页)
GET /api/admin/notifications
Query 参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| page | number | 选填 | 页码(默认 1) |
| limit | number | 选填 | 每页条数(默认 20) |
| type | string | 选填 | 通知类型:system / bill_invitation / payment / budget_alert / ai_error |
| is_read | string | 选填 | 已读状态:true(已读)/ false(未读) |
| user_id | string | 选填 | 按用户 ID 精确过滤 |
| search | string | 选填 | 模糊搜索:通知标题 / 内容 / 用户昵称 / 手机号 |
| start_date | string | 选填 | 创建时间下限(YYYY-MM-DD),如 2026-04-01 |
| end_date | string | 选填 | 创建时间上限(YYYY-MM-DD),含当天 23:59:59 |
响应:
{
"notifications": [{
"id": "string",
"user_id": "string",
"user_nickname": "string",
"user_phone": "string",
"type": "string",
"title": "string",
"content": "string",
"metadata": {},
"is_read": 0,
"created_at": "ISO8601"
}],
"total": 100,
"totalUnread": 5,
"totalPages": 5,
"currentPage": 1
}
2. 标记单条通知为已读
PUT /api/admin/notifications/:id/read
路径参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 必填 | 通知 ID |
响应: {"success": true}
3. 删除单条通知
DELETE /api/admin/notifications/:id
路径参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 必填 | 通知 ID |
响应: {"success": true}
4. 标记全部通知为已读
PUT /api/admin/notifications/mark-all-read
响应: {"success": true}
5. 清空所有通知
DELETE /api/admin/notifications/clear-all
响应: {"success": true}
GET/notifications
PUT/notifications/:id/read
DELETE/notifications/:id
PUT/notifications/mark-all-read
DELETE/notifications/clear-all
PUT/admin/notifications/:id/read
**说明**:将指定通知标记为已读。
**响应**:
{ success: true }
---
PUT/admin/notifications/mark-all-read
**说明**:将所有通知标记为已读。
**响应**:
{ success: true }
---
DELETE/admin/notifications/:id
**说明**:删除指定通知。
---
DELETE/admin/notifications/clear-all
**说明**:清空所有通知。