sys_config.go 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package router
  2. import (
  3. "go-admin/app/admin/apis"
  4. "go-admin/common/middleware"
  5. "github.com/gin-gonic/gin"
  6. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerSysConfigRouter)
  10. }
  11. // 需认证的路由代码
  12. func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  13. api := apis.SysConfig{}
  14. r := v1.Group("/config").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  15. {
  16. r.GET("", api.GetPage)
  17. r.GET("/:id", api.Get)
  18. r.POST("", api.Insert)
  19. r.PUT("/:id", api.Update)
  20. r.DELETE("", api.Delete)
  21. }
  22. r1 := v1.Group("/configKey").Use(authMiddleware.MiddlewareFunc())
  23. {
  24. r1.GET("/:configKey", api.GetSysConfigByKEYForService)
  25. }
  26. r2 := v1.Group("/app-config")
  27. {
  28. r2.GET("", api.Get2SysApp)
  29. }
  30. r3 := v1.Group("/set-config").Use(authMiddleware.MiddlewareFunc())
  31. {
  32. r3.PUT("", api.Update2Set)
  33. r3.GET("", api.Get2Set)
  34. }
  35. }