web
This commit is contained in:
@@ -137,6 +137,22 @@ func (h *CommentHandler) GetCommentStats(c *gin.Context) {
|
||||
response.Success(c, stats)
|
||||
}
|
||||
|
||||
// GetHighRatingComments 获取高分评论(用于首页展示)
|
||||
func (h *CommentHandler) GetHighRatingComments(c *gin.Context) {
|
||||
limit, _ := strconv.Atoi(c.DefaultQuery("limit", "6"))
|
||||
|
||||
comments, err := h.commentService.GetHighRatingComments(limit)
|
||||
if err != nil {
|
||||
response.ErrorWithMessage(c, response.ERROR, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 转换为响应格式
|
||||
result := h.convertToResponseList(comments)
|
||||
|
||||
response.Success(c, result)
|
||||
}
|
||||
|
||||
// GetCommentDetail 获取评论详情
|
||||
func (h *CommentHandler) GetCommentDetail(c *gin.Context) {
|
||||
idStr := c.Param("id")
|
||||
|
||||
Reference in New Issue
Block a user