package initialize import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "lc-base-frame/global" "lc-base-frame/middleware" "lc-base-frame/router" "net/http" ) func Routers() *gin.Engine { Router := gin.Default() systemRouter := router.RouterGroupApp.System //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) } logrus.Info("router register success") return Router }