feat: 帖子收藏与用户关注

- 新增收藏功能:favorite 服务与 handler、FavoriteButton 组件
- 新增关注功能:follow 服务与 handler、FollowButton 组件
- 用户主页适配关注/粉丝与收藏展示
- flash 消息工具、广告与侧边栏组件微调
This commit is contained in:
2026-09-26 03:02:40 +08:00
parent 31f5360c26
commit d7c6b3a961
40 changed files with 1528 additions and 268 deletions

View File

@@ -88,6 +88,7 @@ func (h *Handlers) PostDetail(c *gin.Context) {
}
if claims != nil {
post.Liked = h.Like.HasLiked(post.ID, claims.ID)
post.Favorited = h.Favorite.HasFavorited(post.ID, claims.ID)
}
h.attachNecroReplyHint(claims, post)
c.JSON(http.StatusOK, gin.H{"post": post})
@@ -275,6 +276,7 @@ func (h *Handlers) UnlockPostPassword(c *gin.Context) {
}
if claims != nil {
post.Liked = h.Like.HasLiked(post.ID, claims.ID)
post.Favorited = h.Favorite.HasFavorited(post.ID, claims.ID)
}
h.attachNecroReplyHint(claims, post)
c.JSON(http.StatusOK, gin.H{"post": post})