sys_config.go 988 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package router
  2. import (
  3. "Medical_OAuth/common/middleware"
  4. "github.com/gin-gonic/gin"
  5. "Medical_OAuth/app/admin/controller"
  6. jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerSysConfigRouter)
  10. }
  11. // 需认证的路由代码
  12. func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  13. cont := controller.SysConfig{}
  14. r := v1.Group("/config").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("/configKey").Use(authMiddleware.MiddlewareFunc())
  23. {
  24. r1.GET("/:configKey", cont.GetSysConfigByKEYForService)
  25. }
  26. r2 := v1.Group("/app-config")
  27. {
  28. r2.GET("", cont.Get2SysApp)
  29. }
  30. r3 := v1.Group("/set-config").Use(authMiddleware.MiddlewareFunc())
  31. {
  32. r3.PUT("", cont.Update2Set)
  33. r3.GET("", cont.Get2Set)
  34. }
  35. }