web
This commit is contained in:
@@ -113,6 +113,15 @@ func (s *CommentService) GetCommentStats(productID uint) (*model.CommentStats, e
|
||||
return s.commentRepo.GetStats(productID)
|
||||
}
|
||||
|
||||
// GetHighRatingComments 获取高分评论(用于首页展示)
|
||||
func (s *CommentService) GetHighRatingComments(limit int) ([]model.Comment, error) {
|
||||
if limit <= 0 || limit > 50 {
|
||||
limit = 6 // 默认6条
|
||||
}
|
||||
// 获取评分>=4的高分评论
|
||||
return s.commentRepo.GetHighRatingComments(limit, 4)
|
||||
}
|
||||
|
||||
// GetCommentByID 获取评论详情
|
||||
func (s *CommentService) GetCommentByID(id uint) (*model.Comment, error) {
|
||||
return s.commentRepo.GetByID(id)
|
||||
|
||||
Reference in New Issue
Block a user