sys_role.go 785 B

12345678910111213141516171819202122232425262728293031
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  5. "go-admin/app/admin/apis"
  6. "go-admin/common/middleware"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerSysRoleRouter)
  10. }
  11. // 需认证的路由代码
  12. func registerSysRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  13. api := apis.SysRole{}
  14. r := v1.Group("/role").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("").Use(authMiddleware.MiddlewareFunc())
  23. {
  24. r1.PUT("/role-status", api.Update2Status)
  25. r1.PUT("/roledatascope", api.Update2DataScope)
  26. }
  27. }