feat: 帖子全局/板块置顶支持权重排序,优化列表与详情渲染

This commit is contained in:
2026-09-08 23:54:03 +08:00
parent de2f5e8be8
commit 711cd8b759
16 changed files with 362 additions and 64 deletions

View File

@@ -813,11 +813,17 @@ func (s *PostService) Purge(postID uint) error {
})
}
func (s *PostService) SetPinned(postID uint, pinned bool) error {
func (s *PostService) SetPinned(postID uint, pinned int) error {
if pinned < 0 {
pinned = 0
}
return model.DB.Model(&model.Post{}).Where("id = ?", postID).Update("pinned", pinned).Error
}
func (s *PostService) SetBoardPinned(postID uint, boardPinned bool) error {
func (s *PostService) SetBoardPinned(postID uint, boardPinned int) error {
if boardPinned < 0 {
boardPinned = 0
}
return model.DB.Model(&model.Post{}).Where("id = ?", postID).Update("board_pinned", boardPinned).Error
}