feat(comments): 实现评论点赞功能
- 在数据库和API中添加likes字段支持 - 新增评论点赞接口和前端交互逻辑 - 在前端展示点赞数并处理点赞操作 - 更新相关组件和存储逻辑以支持点赞功能
This commit is contained in:
@@ -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
|
||||
post_slug as postSlug, 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
|
||||
post_slug as postSlug, priority, COALESCE(likes, 0) as likes
|
||||
FROM Comment
|
||||
WHERE status = "approved" AND post_slug IN (${placeholders})
|
||||
ORDER BY priority DESC, created DESC
|
||||
|
||||
Reference in New Issue
Block a user