sys_service.go 919 B

1234567891011121314151617181920212223242526272829303132333435
  1. package router
  2. import (
  3. "Medical_OAuth/app/admin/controller"
  4. "Medical_OAuth/common/middleware"
  5. "github.com/gin-gonic/gin"
  6. jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerSysServiceRouter)
  10. }
  11. // 需认证的路由代码
  12. func registerSysServiceRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  13. cont := controller.SysService{}
  14. r := v1.Group("/service").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  15. {
  16. r.GET("", cont.GetPage)
  17. r.GET("/:id", cont.Get)
  18. r.POST("", cont.Insert)
  19. r.PUT("/:id", cont.Update)
  20. r.DELETE("", cont.Delete)
  21. }
  22. r1 := v1.Group("")
  23. {
  24. // 服务发现
  25. r1.POST("/service-disco", cont.Discovery)
  26. }
  27. r2 := v1.Group("/service").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckService())
  28. {
  29. // 服务获取用户信息
  30. r2.GET("/userinfo", cont.UserInfo)
  31. }
  32. }