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