🎨 重构用户端前端为vue开发,完善基础类和角色相关接口

This commit is contained in:
2026-02-10 21:55:45 +08:00
parent db934ebed7
commit 56e821b222
92 changed files with 18377 additions and 21 deletions

36
server/router/app/auth.go Normal file
View File

@@ -0,0 +1,36 @@
package app
import (
v1 "git.echol.cn/loser/st/server/api/v1"
"git.echol.cn/loser/st/server/middleware"
"github.com/gin-gonic/gin"
)
type AuthRouter struct{}
// InitAuthRouter 初始化前台用户认证路由
func (r *AuthRouter) InitAuthRouter(Router *gin.RouterGroup) {
authRouter := Router.Group("auth")
authApi := v1.ApiGroupApp.AppApiGroup.AuthApi
{
// 公开路由(无需认证)
authRouter.POST("register", authApi.Register) // 注册
authRouter.POST("login", authApi.Login) // 登录
authRouter.POST("refresh", authApi.RefreshToken) // 刷新Token
}
// 需要认证的路由
authRouterAuth := Router.Group("auth").Use(middleware.AppJWTAuth())
{
authRouterAuth.POST("logout", authApi.Logout) // 登出
authRouterAuth.GET("userinfo", authApi.GetUserInfo) // 获取用户信息
}
// 用户相关路由
userRouter := Router.Group("user").Use(middleware.AppJWTAuth())
{
userRouter.PUT("profile", authApi.UpdateProfile) // 更新用户信息
userRouter.POST("change-password", authApi.ChangePassword) // 修改密码
}
}