12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package router
- import (
- "cold-logistics/common/actions"
- "github.com/gin-gonic/gin"
- "cold-logistics/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("/bind", cont.GetPageFoeBind)
- 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)
- }
- }
|