34 lines
844 B
Go
34 lines
844 B
Go
package v1
|
|
|
|
import (
|
|
"nl-video-api/api/middleware"
|
|
"nl-video-api/internal/controller/user"
|
|
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
)
|
|
|
|
// UserWatchHistoryGroup 用户观看历史路由组
|
|
func UserWatchHistoryGroup(group *ghttp.RouterGroup) {
|
|
group.Group("/user/history", func(group *ghttp.RouterGroup) {
|
|
// 应用中间件
|
|
group.Middleware(middleware.CORS)
|
|
group.Middleware(middleware.Auth) // 用户认证中间件
|
|
group.Middleware(middleware.RequestLog)
|
|
|
|
// 添加观看历史
|
|
group.POST("/add", user.UserWatchHistory.Add)
|
|
|
|
// 观看历史列表
|
|
group.GET("/list", user.UserWatchHistory.List)
|
|
|
|
// 删除观看历史
|
|
group.POST("/delete", user.UserWatchHistory.Delete)
|
|
|
|
// 清空观看历史
|
|
group.POST("/clear", user.UserWatchHistory.Clear)
|
|
|
|
// 获取观看进度
|
|
group.GET("/get", user.UserWatchHistory.Get)
|
|
})
|
|
}
|