Notifications 通知管理

共 5 个接口 · 路由前缀 /api/admin

基础信息

  • Base URL: /api/admin
  • 认证方式: JWT Bearer Token

数据库表

  • notifications — 通知表
  • users — 用户表(LEFT JOIN 获取用户昵称)

接口列表

1. 获取通知列表(分页)

GET /api/admin/notifications

Query 参数:

参数类型必填说明
pagenumber选填页码(默认 1)
limitnumber选填每页条数(默认 20)

响应:

{
  "notifications": [{
    "id": "string",
    "user_id": "string",
    "user_nickname": "string",
    "type": "string",
    "title": "string",
    "message": "string",
    "is_read": 0,
    "created_at": "ISO8601"
  }],
  "totalPages": 5,
  "currentPage": 1
}

2. 标记单条通知为已读

PUT /api/admin/notifications/:id/read

路径参数:

参数类型必填说明
idstring必填通知 ID

响应: {"success": true}

3. 删除单条通知

DELETE /api/admin/notifications/:id

路径参数:

参数类型必填说明
idstring必填通知 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
**说明**:清空所有通知。