package router import ( "Medical_OAuth/common/actions" "Medical_OAuth/common/middleware" "github.com/gin-gonic/gin" "Medical_OAuth/app/admin/controller" jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth" ) func init() { routerCheckRole = append(routerCheckRole, registerSysRoleRouter) } // 需认证的路由代码 func registerSysRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { cont := controller.SysRoleController{} r := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction()) { r.GET("", cont.GetPage) r.GET("/:id", cont.Get) r.POST("", cont.Insert) r.PUT("/:id", cont.Update) r.DELETE("", cont.Delete) } // 角色关联的api r1 := v1.Group("/role-api").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { r1.GET("/:id", cont.GetRoleApi) r1.PUT("/:id", cont.UpdateRoleApi) } // 角色关联的菜单 r2 := v1.Group("/role-menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { r2.GET("/:id", cont.GetRoleMenu) r2.PUT("/:id", cont.UpdateRoleMenu) } }