1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package initialize
- import (
- "github.com/gin-gonic/gin"
- "github.com/sirupsen/logrus"
- "lc-fangdaosha/global"
- "lc-fangdaosha/middleware"
- "lc-fangdaosha/router"
- "net/http"
- )
- func Routers() *gin.Engine {
- Router := gin.Default()
- systemRouter := router.RouterGroupApp.System
- isApiRouter := router.RouterGroupApp.IsApi
- appRouterGroup := router.RouterGroupApp.AppGroup
- //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) //isapi
- }
- //应用层
- {
- appRouterGroup.GatewayRouter.InitGatewayRouter(PrivateGroup) //网关
- appRouterGroup.CameraRouter.InitCameraRouter(PrivateGroup) //摄像机
- appRouterGroup.EventRouter.InitInfoRouter(PrivateGroup) //事件
- appRouterGroup.PictureRouter.InitInfoRouter(PrivateGroup) //图片
- }
- logrus.Info("router register success")
- return Router
- }
|