package initialize import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "lcfns/global" "lcfns/middleware" "lcfns/router" "net/http" ) func Routers() *gin.Engine { Router := gin.Default() systemRouter := router.RouterGroupApp.System isApiRouter := router.RouterGroupApp.IsApi appRouterGroup := router.RouterGroupApp.AppGroup ipcast := router.RouterGroupApp.Ipcast //Router.StaticFS(global.Config.Local.StorePath, http.Dir(global.Config.Local.StorePath)) //docs.SwaggerInfo.BasePath = global.Config.System.RouterPrefix //Router.GET(global.Config.System.RouterPrefix+"/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) PublicGroup := Router.Group(global.Config.System.RouterPrefix) { PublicGroup.GET("/health", func(c *gin.Context) { c.JSON(http.StatusOK, "ok") }) } { systemRouter.InitBaseRouter(PublicGroup) //systemRouter.InitMenuRouter(PublicGroup) } PrivateGroup := Router.Group(global.Config.System.RouterPrefix) PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler()) //系统层 { systemRouter.InitApiRouter(PrivateGroup, PublicGroup) systemRouter.InitJwtRouter(PrivateGroup) systemRouter.InitUserRouter(PrivateGroup, PublicGroup) systemRouter.InitMenuRouter(PrivateGroup) //systemRouter.InitSystemRouter(PrivateGroup) systemRouter.InitCasbinRouter(PrivateGroup) //systemRouter.InitAutoCodeRouter(PrivateGroup) systemRouter.InitAuthorityRouter(PrivateGroup) systemRouter.InitSysDictionaryRouter(PrivateGroup) //systemRouter.InitAutoCodeHistoryRouter(PrivateGroup) //systemRouter.InitSysOperationRecordRouter(PrivateGroup) systemRouter.InitSysDictionaryDetailRouter(PrivateGroup) //systemRouter.InitAuthorityBtnRouterRouter(PrivateGroup) //systemRouter.InitChatGptRouter(PrivateGroup) } //isapi { isApiRouter.InitInfoRouter(PrivateGroup) } //ipcast { ipcast.InitInfoRouter(PrivateGroup, PublicGroup) } //应用层 { appRouterGroup.GatewayRouter.InitInfoRouter(PrivateGroup) appRouterGroup.CameraRouter.InitInfoRouter(PrivateGroup) appRouterGroup.EventRouter.InitInfoRouter(PrivateGroup) appRouterGroup.PictureRouter.InitInfoRouter(PrivateGroup) } logrus.Info("router register success") return Router }