package router import ( "Medical_OAuth/app/admin/controller" "Medical_OAuth/common/middleware" "github.com/gin-gonic/gin" jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth" ) func init() { routerCheckRole = append(routerCheckRole, registerSysServiceRouter) } // 需认证的路由代码 func registerSysServiceRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { cont := controller.SysService{} r := v1.Group("/service").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { r.GET("", cont.GetPage) r.GET("/:id", cont.Get) r.POST("", cont.Insert) r.PUT("/:id", cont.Update) r.DELETE("", cont.Delete) } r1 := v1.Group("") { // 服务发现 r1.POST("/service-disco", cont.Discovery) } r2 := v1.Group("/service").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckService()) { // 服务获取用户信息 r2.GET("/userinfo", cont.UserInfo) } }