update
This commit is contained in:
@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user