feat: 点赞相关rabbitMQ
This commit is contained in:
@@ -7,12 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type LikeHandler struct {
|
||||
service *LikeService
|
||||
videoService *VideoService
|
||||
service *LikeService
|
||||
}
|
||||
|
||||
func NewLikeHandler(service *LikeService, videoService *VideoService) *LikeHandler {
|
||||
return &LikeHandler{service: service, videoService: videoService}
|
||||
func NewLikeHandler(service *LikeService) *LikeHandler {
|
||||
return &LikeHandler{service: service}
|
||||
}
|
||||
|
||||
func (lh *LikeHandler) Like(c *gin.Context) {
|
||||
@@ -40,10 +39,6 @@ func (lh *LikeHandler) Like(c *gin.Context) {
|
||||
c.JSON(500, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
if err := lh.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": "like success"})
|
||||
}
|
||||
|
||||
@@ -72,10 +67,6 @@ func (lh *LikeHandler) Unlike(c *gin.Context) {
|
||||
c.JSON(500, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
if err := lh.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": "unlike success"})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user