This commit is contained in:
toom1996
2026-08-31 19:59:56 +08:00
parent a325e438be
commit f4f6e02e3c
14 changed files with 594 additions and 20 deletions

View File

@ -8,3 +8,30 @@ type UserPayload struct {
Username string `json:"username"`
Email string `json:"email"`
}
// ---------- 登录 ----------
// LoginRequest 登录请求体。account 支持用户名或邮箱。
type LoginRequest struct {
Account string `json:"account" binding:"required"`
Password string `json:"password" binding:"required"`
}
// LoginResponse 登录成功响应(双令牌)。
type LoginResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"` // access token 有效期(秒)
User UserPayload `json:"user"`
}
// RefreshRequest 续期请求体。
type RefreshRequest struct {
RefreshToken string `json:"refresh_token" binding:"required"`
}
// RefreshResponse 续期成功响应。
type RefreshResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
}