2026-07-03 15:58:29 +08:00
|
|
|
// Package dto 定义请求和响应的数据传输对象
|
|
|
|
|
package dto
|
|
|
|
|
|
|
|
|
|
// LoginRequest 登录请求
|
|
|
|
|
type LoginRequest struct {
|
|
|
|
|
Username string `json:"username" binding:"required"` // 用户名, 必填
|
|
|
|
|
Password string `json:"password" binding:"required"` // 密码, 必填
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-10 17:33:33 +08:00
|
|
|
// AppLoginRequest 应用登录请求(用户名+appId)
|
|
|
|
|
type AppLoginRequest struct {
|
|
|
|
|
Username string `json:"username" binding:"required"` // 用户名, 必填
|
|
|
|
|
AppID string `json:"app_id" binding:"required"` // 开放平台应用ID, 必填
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-03 15:58:29 +08:00
|
|
|
// RegisterRequest 注册请求
|
|
|
|
|
type RegisterRequest struct {
|
|
|
|
|
Username string `json:"username" binding:"required,min=3,max=64"` // 用户名, 3-64字符
|
|
|
|
|
Password string `json:"password" binding:"required,min=6,max=128"` // 密码, 6-128字符
|
|
|
|
|
Email string `json:"email" binding:"omitempty,email"` // 邮箱, 可选
|
|
|
|
|
Nickname string `json:"nickname" binding:"omitempty,max=64"` // 昵称, 可选
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LoginResponse 登录响应
|
|
|
|
|
type LoginResponse struct {
|
|
|
|
|
Token string `json:"token"`
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
Role string `json:"role"`
|
|
|
|
|
MustChangePwd bool `json:"must_change_pwd"` // 首次登录需改密码
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ChangePasswordRequest 修改密码请求
|
|
|
|
|
type ChangePasswordRequest struct {
|
|
|
|
|
OldPassword string `json:"old_password" binding:"required"` // 当前密码
|
|
|
|
|
NewPassword string `json:"new_password" binding:"required,min=6"` // 新密码
|
|
|
|
|
}
|