package route import ( "github.com/gin-gonic/gin" "wireguard-dashboard/http/api" "wireguard-dashboard/middleware" ) func UserApi(r *gin.RouterGroup) { // 登陆相关API login := r.Group("/login", middleware.SystemLogRequest()) { login.POST("", api.UserApi().Login) } // 用户登陆后相关的API userApi := r.Group("user", middleware.Authorization(), middleware.SystemLogRequest()) { userApi.DELETE("logout", api.UserApi().Logout) // 用户退出登陆 userApi.GET("", api.UserApi().GetUser) // 获取登陆用户信息 userApi.POST("save", middleware.Permission(), api.UserApi().Save) // 新增/编辑用户信息 userApi.POST("change-password", api.UserApi().ChangePassword) // 更改密码 userApi.GET("list", middleware.Permission(), api.UserApi().List) // 用户列表 userApi.PUT("change-status", middleware.Permission(), api.UserApi().ChangeUserState) // 变更状态 userApi.DELETE("delete/:id", middleware.Permission(), api.UserApi().DeleteUser) // 删除用户 userApi.POST("change-avatar", api.UserApi().ChangeAvatar) // 更换头像 } }