This commit is contained in:
sjk
2025-11-28 15:18:10 +08:00
parent ad4a600af9
commit 5683f35942
188 changed files with 53680 additions and 1062 deletions

View File

@@ -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)