sys_user.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package router
  2. import (
  3. "Medical_OAuth/common/actions"
  4. "Medical_OAuth/common/middleware"
  5. "github.com/gin-gonic/gin"
  6. "Medical_OAuth/app/admin/controller"
  7. jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
  8. )
  9. func init() {
  10. routerCheckRole = append(routerCheckRole, registerSysUserRouter)
  11. }
  12. // 需认证的路由代码
  13. func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  14. cont := controller.SysUser{}
  15. r := v1.Group("/sys-user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction())
  16. {
  17. r.GET("", cont.GetPage)
  18. r.GET("/:id", cont.Get)
  19. r.POST("", cont.Insert)
  20. r.PUT("", cont.Update)
  21. r.DELETE("", cont.Delete)
  22. }
  23. user := v1.Group("/user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction())
  24. {
  25. user.GET("/profile", cont.GetProfile)
  26. user.GET("/info", cont.GetInfo)
  27. user.PUT("/status", cont.UpdateStatus)
  28. user.PUT("/pwd/set", cont.UpdatePwd)
  29. user.PUT("/pwd/reset", cont.ResetPwd)
  30. }
  31. r2 := v1.Group("")
  32. {
  33. r2.POST("/register", cont.Register)
  34. r2.GET("/verify-code", cont.VerifyCode)
  35. }
  36. r3 := v1.Group("/newest-token").Use(middleware.AuthCheckService())
  37. {
  38. r3.GET("/:userId", cont.GetNewestToken)
  39. }
  40. }