feat: 分离文章slug与URL字段并支持slug模式匹配查询
- 新增 `post_url` 字段存储文章完整URL,`post_slug` 仅存储标识符 - 更新管理后台评论列表、编辑、统计及域名获取接口以使用新字段 - 修改公共评论查询接口,支持slug精确匹配及带`?`、`#`参数的模糊匹配 - 更新前端管理界面,在评论编辑表单中增加"评论地址"(`postUrl`)字段 - 同步更新API文档,明确字段用途及查询参数说明
This commit is contained in:
@@ -44,7 +44,8 @@ GET /admin/comments/list
|
||||
"created": 1736762400000,
|
||||
"name": "张三",
|
||||
"email": "zhangsan@example.com",
|
||||
"postSlug": "https://your-blog.example.com/blog/hello-world",
|
||||
"postSlug": "hello-world",
|
||||
"postUrl": "https://your-blog.example.com/blog/hello-world",
|
||||
"url": "https://zhangsan.me",
|
||||
"ipAddress": "127.0.0.1",
|
||||
"contentText": "很棒的文章!",
|
||||
@@ -63,6 +64,25 @@ GET /admin/comments/list
|
||||
}
|
||||
```
|
||||
|
||||
返回字段说明:
|
||||
|
||||
| 字段名 | 类型 | 说明 |
|
||||
| ----------- | ------ | -------------------------- |
|
||||
| `id` | number | 评论 ID |
|
||||
| `created` | number | 创建时间戳 |
|
||||
| `name` | string | 评论者昵称 |
|
||||
| `email` | string | 评论者邮箱 |
|
||||
| `postSlug` | string | 文章 slug |
|
||||
| `postUrl` | string | null) | 文章完整 URL |
|
||||
| `url` | string | null) | 评论者个人主页地址 |
|
||||
| `ipAddress` | string | 评论者 IP 地址 |
|
||||
| `contentText` | string | 评论内容(纯文本) |
|
||||
| `contentHtml` | string | 评论内容(渲染后的 HTML) |
|
||||
| `status` | string | 评论状态 |
|
||||
| `priority` | number | 置顶权重 |
|
||||
| `ua` | string | 用户代理 |
|
||||
| `avatar` | string | 头像 URL(Gravatar) |
|
||||
|
||||
**鉴权错误**
|
||||
|
||||
- 未携带 Token 或 Token 失效:
|
||||
@@ -156,7 +176,8 @@ PUT /admin/comments/update
|
||||
"name": "张三",
|
||||
"email": "zhangsan@example.com",
|
||||
"url": "https://zhangsan.me",
|
||||
"postSlug": "https://example.com/blog/hello-world",
|
||||
"postSlug": "hello-world",
|
||||
"postUrl": "https://example.com/blog/hello-world",
|
||||
"contentText": "更新后的评论内容",
|
||||
"status": "approved",
|
||||
"priority": 2
|
||||
@@ -171,10 +192,12 @@ PUT /admin/comments/update
|
||||
| `name` | string | 是 | 评论者昵称 |
|
||||
| `email` | string | 是 | 评论者邮箱 |
|
||||
| `url` | string | 否 | 评论者个人主页或站点地址 |
|
||||
| `postSlug` | string | 否 | 评论地址(文章 URL),不传则保持原值 |
|
||||
| `contentText` | string | 是 | 评论内容(纯文本) |
|
||||
`| `status` | string | 否 | 评论状态,可选 `approved`、`pending`、`rejected` |
|
||||
| `priority` | number | 否 | 置顶权重,默认为 1,数值越大越靠前 |
|
||||
| `postSlug` | string | 否 | 文章 slug,不传则保持原值,支持 `postSlug` 或 `post_slug` |
|
||||
| `postUrl` | string | 否 | 文章完整 URL,不传则保持原值,支持 `postUrl` 或 `post_url` |
|
||||
| `content` | string | 是* | 评论内容(Markdown 或纯文本),与 `contentText` 二选一 |
|
||||
| `contentText` | string | 是* | 评论内容(纯文本),与 `content` 二选一 |
|
||||
| `status` | string | 否 | 评论状态,可选 `approved`、`pending`、`rejected` |
|
||||
| `priority` | number | 否 | 置顶权重,默认为 1,数值越大越靠前,必须 >= 1 |
|
||||
|
||||
**置顶权重说明**:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user