feat(analytics): 扩展页面访问统计接口并新增站点隔离文档

- 在 `/admin/analytics/pages` 接口响应中添加 `itemsByPv` 和 `itemsByLatest` 字段,分别返回按访问量和最新访问排序的前20条数据,优化前端数据展示逻辑
- 前端管理后台适配新的接口响应结构,提升页面访问统计页面的性能和用户体验
- 新增站点隔离配置文档 (`/docs/config/site-isolation.md`),说明如何通过 `siteId` 配置实现数据隔离
- 在前端配置指南中补充 `siteId` 配置示例
- 新增常见问题文档 (`/docs/common-problems.md`),解答设置 `siteId` 后评论数据不显示的问题及数据迁移方案
- 在导航栏和侧边栏添加“常见问题”和“配置”相关入口,完善文档结构
- 修复前端组件 API 调用中 `postSlug` 参数可能为 `postUrl` 的兼容性问题
This commit is contained in:
anghunk
2026-02-09 14:47:28 +08:00
parent 2453929455
commit 2085a4733c
11 changed files with 149 additions and 51 deletions

View File

@@ -124,13 +124,24 @@ GET /admin/analytics/pages
"postUrl": "https://example.com/blog/hello-world",
"pv": 100,
"lastVisitAt": 1737593600000
},
}
],
"itemsByPv": [
{
"postSlug": "https://example.com/about",
"postTitle": "关于我",
"postUrl": "https://example.com/about",
"pv": 50,
"lastVisitAt": 1737593500000
"postSlug": "https://example.com/blog/hello-world",
"postTitle": "Hello World",
"postUrl": "https://example.com/blog/hello-world",
"pv": 100,
"lastVisitAt": 1737593600000
}
],
"itemsByLatest": [
{
"postSlug": "https://example.com/blog/hello-world",
"postTitle": "Hello World",
"postUrl": "https://example.com/blog/hello-world",
"pv": 100,
"lastVisitAt": 1737593600000
}
]
}
@@ -138,13 +149,16 @@ GET /admin/analytics/pages
字段说明:
| 字段名 | 类型 | 说明 |
| ------------- | ------ | -------------------------- |
| `postSlug` | string | 文章唯一标识符 |
| `postTitle` | string \| null | 文章标题 |
| `postUrl` | string \| null | 文章 URL |
| `pv` | number | 访问量PV |
| `lastVisitAt` | number \| null | 最后访问时间戳(毫秒) |
| 字段名 | 类型 | 说明 |
| ------------------- | ------ | ----------------------------------------- |
| `items` | Array | 根据 `order` 参数返回的主列表 |
| `itemsByPv` | Array | 按 `order=pv` 规则排序后的前 20 条数据 |
| `itemsByLatest` | Array | 按 `order=latest` 规则排序后的前 20 条数据 |
| `postSlug` | string | 文章唯一标识符 |
| `postTitle` | string \| null | 文章标题 |
| `postUrl` | string \| null | 文章 URL |
| `pv` | number | 访问量PV |
| `lastVisitAt` | number \| null | 最后访问时间戳(毫秒) |
**错误响应**