feat: 评论相关rabbitMQ

This commit is contained in:
Leon
2025-12-30 01:25:54 +08:00
parent 475dfbe8da
commit 631cb2203f
4 changed files with 263 additions and 10 deletions

View File

@@ -10,11 +10,10 @@ import (
type CommentHandler struct {
service *CommentService
accountService *account.AccountService
videoService *VideoService
}
func NewCommentHandler(service *CommentService, accountService *account.AccountService, videoService *VideoService) *CommentHandler {
return &CommentHandler{service: service, accountService: accountService, videoService: videoService}
func NewCommentHandler(service *CommentService, accountService *account.AccountService) *CommentHandler {
return &CommentHandler{service: service, accountService: accountService}
}
func (h *CommentHandler) PublishComment(c *gin.Context) {
var req PublishCommentRequest
@@ -50,10 +49,6 @@ func (h *CommentHandler) PublishComment(c *gin.Context) {
c.JSON(400, gin.H{"error": err.Error()})
return
}
if err := h.videoService.UpdatePopularity(c.Request.Context(), req.VideoID, 1); err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return
}
c.JSON(200, gin.H{"message": "comment published successfully"})
}