sys_user.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package router
  2. import (
  3. "cold-logistics/common/actions"
  4. "github.com/gin-gonic/gin"
  5. "cold-logistics/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("/bind", cont.GetPageFoeBind)
  19. r.GET("/:id", cont.Get)
  20. r.POST("", cont.Insert)
  21. r.PUT("", cont.Update)
  22. r.DELETE("", cont.Delete)
  23. r.PUT("/pwd/reset", cont.ResetPwd)
  24. }
  25. user := v1.Group("/user").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  26. {
  27. user.GET("/profile", cont.GetProfile)
  28. user.GET("/info", cont.GetInfo)
  29. user.PUT("/status", cont.UpdateStatus)
  30. user.PUT("/pwd/set", cont.UpdatePwd)
  31. }
  32. }
  33. func registerSysUserRouter2(v1 *gin.RouterGroup) {
  34. cont := controller.SysUser{}
  35. r2 := v1.Group("")
  36. {
  37. r2.GET("/verify-code", cont.VerifyCode)
  38. }
  39. }