feat: 调整 Feed 排序为新评论/新帖子/推荐帖

默认按新评论;推荐排序优先 featured,并将用户可见「精华」文案改为「推荐」。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-01 01:59:01 +08:00
parent 132ca5c82c
commit ba60a9b1c4
13 changed files with 44 additions and 40 deletions

View File

@@ -286,7 +286,7 @@ func (h *Handlers) APIAdminBoardPinPost(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": msg, "board_pinned": req.BoardPinned})
}
// APIAdminFeaturePost 设为精华/取消精华JSON
// APIAdminFeaturePost 设为推荐/取消推荐JSON
func (h *Handlers) APIAdminFeaturePost(c *gin.Context) {
id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
var req struct {
@@ -300,9 +300,9 @@ func (h *Handlers) APIAdminFeaturePost(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
msg := "已取消精华"
msg := "已取消推荐"
if req.Featured {
msg = "已设为精华"
msg = "已设为推荐"
}
c.JSON(http.StatusOK, gin.H{"message": msg, "featured": req.Featured})
}
@@ -976,7 +976,7 @@ func (h *Handlers) APIPosts(c *gin.Context) {
Tag: tag,
Author: author,
TitleOnly: titleOnly,
Sort: c.DefaultQuery("sort", "latest"),
Sort: c.DefaultQuery("sort", "reply"),
ViewerID: h.currentUserID(c),
ViewerIsAdmin: h.isAdmin(c),
}