123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package router
- import (
- "Medical_OAuth/common/actions"
- "Medical_OAuth/common/middleware"
- "github.com/gin-gonic/gin"
- "Medical_OAuth/app/admin/controller"
- jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
- )
- func init() {
- routerCheckRole = append(routerCheckRole, registerSysUserRouter)
- }
- // 需认证的路由代码
- func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
- cont := controller.SysUser{}
- r := v1.Group("/sys-user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction())
- {
- r.GET("", cont.GetPage)
- r.GET("/:id", cont.Get)
- r.POST("", cont.Insert)
- r.PUT("", cont.Update)
- r.DELETE("", cont.Delete)
- }
- user := v1.Group("/user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction())
- {
- user.GET("/profile", cont.GetProfile)
- user.GET("/info", cont.GetInfo)
- user.PUT("/status", cont.UpdateStatus)
- user.PUT("/pwd/set", cont.UpdatePwd)
- user.PUT("/pwd/reset", cont.ResetPwd)
- }
- r2 := v1.Group("")
- {
- r2.POST("/register", cont.Register)
- r2.GET("/verify-code", cont.VerifyCode)
- }
- r3 := v1.Group("/newest-token").Use(middleware.AuthCheckService())
- {
- r3.GET("/:userId", cont.GetNewestToken)
- }
- }
|