refactor(admin): 合并功能设置到网站设置并更新文档

将功能开关设置从独立页面合并到网站设置页面,简化导航结构
更新相关API文档和功能说明文档
移除不再使用的FeatureSettingsView组件和相关路由配置
This commit is contained in:
anghunk
2026-01-22 22:37:00 +08:00
parent e0be92b1fe
commit 43fe456d06
9 changed files with 200 additions and 299 deletions

View File

@@ -37,6 +37,7 @@ export const apiSidebar = [
{ text: '邮件通知', link: '/api/admin/email-notify' },
{ text: '统计数据', link: '/api/admin/stats' },
{ text: '访问统计', link: '/api/admin/analytics' },
{ text: '点赞开关', link: '/api/admin/feature-settings' },
],
},
],

View File

@@ -55,3 +55,8 @@ Token 通过登录接口获取,有效期为 24 小时。
- **获取点赞记录列表** `GET /admin/likes/list` - 获取各页面的点赞记录列表,支持按页面或用户筛选
- **获取点赞统计** `GET /admin/likes/stats` - 获取点赞 Top 页面列表,用于后台展示点赞排行榜
### [功能设置相关](./admin/feature-settings.md)
- **获取功能设置** `GET /admin/settings/feature` - 获取功能开关设置(评论点赞、文章点赞)
- **更新功能设置** `PUT /admin/settings/feature` - 更新功能开关设置

View File

@@ -0,0 +1,96 @@
# 功能设置相关
管理点赞功能开关的接口。
## 获取功能设置
```
GET /admin/settings/feature
```
获取当前的功能开关配置。
- 方法:`GET`
- 路径:`/admin/settings/feature`
- 鉴权:需要 Bearer Token
**成功响应**
- 状态码:`200`
```json
{
"enableCommentLike": true,
"enableArticleLike": true
}
```
字段说明:
| 字段名 | 类型 | 说明 |
| ------------------ | ------- | ---------------------- |
| `enableCommentLike` | boolean | 是否启用评论点赞功能 |
| `enableArticleLike` | boolean | 是否启用文章点赞功能 |
## 更新功能设置
```
PUT /admin/settings/feature
```
更新功能开关配置。
- 方法:`PUT`
- 路径:`/admin/settings/feature`
- 鉴权:需要 Bearer Token
**请求头**
| 名称 | 必填 | 示例 |
| -------------- | ---- | ------------------ |
| `Content-Type` | 是 | `application/json` |
| `Authorization` | 是 | `Bearer <token>` |
**请求体**
```json
{
"enableCommentLike": true,
"enableArticleLike": true
}
```
字段说明:
| 字段名 | 类型 | 必填 | 说明 |
| ------------------ | ------- | ---- | ---------------------- |
| `enableCommentLike` | boolean | 否 | 是否启用评论点赞功能 |
| `enableArticleLike` | boolean | 否 | 是否启用文章点赞功能 |
**成功响应**
- 状态码:`200`
```json
{
"message": "Saved successfully"
}
```
**错误响应**
- 状态码:`401`
```json
{
"message": "Unauthorized"
}
```
- 状态码:`500`
```json
{
"message": "Failed to save feature settings"
}
```

View File

@@ -8,6 +8,22 @@
所有 API 均为 RESTful 风格,无会话 Cookie认证全部通过 `Authorization` 请求头完成。
## 功能特性
### 评论点赞
- 支持对单条评论进行点赞
- 每个用户对同一条评论只能点赞一次(通过 localStorage 本地记录用户 ID 和点赞状态)
- 点赞数实时更新
- 可通过管理员后台功能设置页面开启/关闭评论点赞功能
### 文章点赞
- 支持对整篇文章进行点赞
- 每个用户对同一篇文章只能点赞一次
- 点赞数实时显示
- 可通过管理员后台功能设置页面开启/关闭文章点赞功能
## 版本信息
部署成功后,直接访问 Base URL成功时返回 HTML其中包含类似文案

View File

@@ -45,6 +45,7 @@ GET /api/comments
"postSlug": "/blog/hello-world",
"avatar": "https://gravatar.com/avatar/...",
"priority": 2,
"likes": 5,
"replies": [
{
"id": 2,
@@ -58,7 +59,8 @@ GET /api/comments
"avatar": "https://gravatar.com/avatar/...",
"parentId": 1,
"replyToAuthor": "张三",
"priority": 1
"priority": 1,
"likes": 2
}
]
}