feat: 添加评论文章链接字段并优化自动迁移脚本

- 在 Comment 表中添加 post_url 字段,用于存储文章完整 URL
- 更新前后端 API 以返回 post_url 字段
- 管理后台评论列表显示文章链接(优先显示 post_url)
- 移除前端调试日志并优化自动迁移脚本输出信息
- 通过脚本入口文件统一管理迁移任务
This commit is contained in:
anghunk
2026-02-09 13:18:58 +08:00
parent d90a686ff7
commit b2fd3e72e6
7 changed files with 10 additions and 17 deletions

View File

@@ -36,7 +36,7 @@ export const getComments = async (c: Context<{ Bindings: Bindings }>) => {
let query = `
SELECT id, name, email, url, content_text as contentText,
content_html as contentHtml, created, parent_id as parentId,
post_slug as postSlug, priority, COALESCE(likes, 0) as likes
post_slug as postSlug, post_url as postUrl, priority, COALESCE(likes, 0) as likes
FROM Comment
WHERE status = "approved" AND post_slug = ?
ORDER BY priority DESC, created DESC
@@ -46,7 +46,7 @@ export const getComments = async (c: Context<{ Bindings: Bindings }>) => {
query = `
SELECT id, name, email, url, content_text as contentText,
content_html as contentHtml, created, parent_id as parentId,
post_slug as postSlug, priority, COALESCE(likes, 0) as likes
post_slug as postSlug, post_url as postUrl, priority, COALESCE(likes, 0) as likes
FROM Comment
WHERE status = "approved" AND post_slug IN (${placeholders})
ORDER BY priority DESC, created DESC