Study/server/router/learning/chapter.go

32 lines
1.3 KiB
Go

package learning
import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1"
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
"github.com/gin-gonic/gin"
)
type ChapterRouter struct{}
// InitChapterRouter 初始化 章节 路由信息
func (s *ChapterRouter) InitChapterRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
chapterRouter := Router.Group("chapter").Use(middleware.OperationRecord())
chapterRouterWithoutRecord := Router.Group("chapter")
chapterRouterWithoutAuth := PublicRouter.Group("chapter")
var chapterApi = v1.ApiGroupApp.LearningApiGroup.ChapterApi
{
chapterRouter.POST("createChapter", chapterApi.CreateChapter) // 新建章节
chapterRouter.DELETE("deleteChapter", chapterApi.DeleteChapter) // 删除章节
chapterRouter.DELETE("deleteChapterByIds", chapterApi.DeleteChapterByIds) // 批量删除章节
chapterRouter.PUT("updateChapter", chapterApi.UpdateChapter) // 更新章节
}
{
chapterRouterWithoutRecord.GET("findChapter", chapterApi.FindChapter) // 根据ID获取章节
chapterRouterWithoutRecord.GET("getChapterList", chapterApi.GetChapterList) // 获取章节列表
}
{
chapterRouterWithoutAuth.GET("getChaptersByCourse", chapterApi.GetChaptersByCourse) // 根据课程获取章节列表(无需认证)
}
}