feat: 帖子全局/板块置顶支持权重排序,优化列表与详情渲染
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user