feat:添加热榜功能并添加了增加热度的方法。

This commit is contained in:
Leon
2025-12-26 22:49:17 +08:00
parent 14a905e194
commit 328fae5f07
12 changed files with 327 additions and 10 deletions

View File

@@ -52,7 +52,7 @@ func SetRouter(db *gorm.DB, cache *rediscache.Client) *gin.Engine {
// like
likeRepository := video.NewLikeRepository(db)
likeService := video.NewLikeService(likeRepository, videoRepository)
likeHandler := video.NewLikeHandler(likeService)
likeHandler := video.NewLikeHandler(likeService, videoService)
likeGroup := r.Group("/like")
protectedLikeGroup := likeGroup.Group("")
protectedLikeGroup.Use(middleware.JWTAuth(accountRepository, cache))
@@ -65,7 +65,7 @@ func SetRouter(db *gorm.DB, cache *rediscache.Client) *gin.Engine {
// comment
commentRepository := video.NewCommentRepository(db)
commentService := video.NewCommentService(commentRepository, videoRepository)
commentHandler := video.NewCommentHandler(commentService, accountService)
commentHandler := video.NewCommentHandler(commentService, accountService, videoService)
commentGroup := r.Group("/comment")
{
commentGroup.POST("/listAll", commentHandler.GetAllComments)
@@ -98,6 +98,7 @@ func SetRouter(db *gorm.DB, cache *rediscache.Client) *gin.Engine {
{
feedGroup.POST("/listLatest", feedHandler.ListLatest)
feedGroup.POST("/listLikesCount", feedHandler.ListLikesCount)
feedGroup.POST("/listByPopularity", feedHandler.ListByPopularity)
}
protectedFeedGroup := feedGroup.Group("")
protectedFeedGroup.Use(middleware.JWTAuth(accountRepository, cache))