sys_user.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package router
  2. import (
  3. "cold-delivery/common/actions"
  4. "github.com/gin-gonic/gin"
  5. "cold-delivery/app/admin/controller"
  6. jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerSysUserRouter)
  10. routerNoCheckRole = append(routerNoCheckRole, registerSysUserRouter2)
  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(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. r.PUT("/pwd/reset", cont.ResetPwd)
  23. }
  24. user := v1.Group("/user").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  25. {
  26. user.GET("/profile", cont.GetProfile)
  27. user.GET("/info", cont.GetInfo)
  28. user.PUT("/status", cont.UpdateStatus)
  29. user.PUT("/pwd/set", cont.UpdatePwd)
  30. }
  31. }
  32. func registerSysUserRouter2(v1 *gin.RouterGroup) {
  33. cont := controller.SysUser{}
  34. r2 := v1.Group("")
  35. {
  36. r2.GET("/verify-code", cont.VerifyCode)
  37. }
  38. }