58 lines
2.7 KiB
Go
58 lines
2.7 KiB
Go
|
|
package commands
|
||
|
|
|
||
|
|
// RegisterUserCommand 用户注册命令
|
||
|
|
// @Description 用户注册请求参数
|
||
|
|
type RegisterUserCommand struct {
|
||
|
|
Phone string `json:"phone" binding:"required,len=11" example:"13800138000"`
|
||
|
|
Password string `json:"password" binding:"required,min=6,max=128" example:"password123"`
|
||
|
|
ConfirmPassword string `json:"confirm_password" binding:"required,eqfield=Password" example:"password123"`
|
||
|
|
Code string `json:"code" binding:"required,len=6" example:"123456"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// LoginWithPasswordCommand 密码登录命令
|
||
|
|
// @Description 使用密码进行用户登录请求参数
|
||
|
|
type LoginWithPasswordCommand struct {
|
||
|
|
Phone string `json:"phone" binding:"required,len=11" example:"13800138000"`
|
||
|
|
Password string `json:"password" binding:"required" example:"password123"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// LoginWithSMSCommand 短信验证码登录命令
|
||
|
|
// @Description 使用短信验证码进行用户登录请求参数
|
||
|
|
type LoginWithSMSCommand struct {
|
||
|
|
Phone string `json:"phone" binding:"required,len=11" example:"13800138000"`
|
||
|
|
Code string `json:"code" binding:"required,len=6" example:"123456"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// ChangePasswordCommand 修改密码命令
|
||
|
|
// @Description 修改用户密码请求参数
|
||
|
|
type ChangePasswordCommand struct {
|
||
|
|
UserID string `json:"-"`
|
||
|
|
OldPassword string `json:"old_password" binding:"required" example:"oldpassword123"`
|
||
|
|
NewPassword string `json:"new_password" binding:"required,min=6,max=128" example:"newpassword123"`
|
||
|
|
ConfirmNewPassword string `json:"confirm_new_password" binding:"required,eqfield=NewPassword" example:"newpassword123"`
|
||
|
|
Code string `json:"code" binding:"required,len=6" example:"123456"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// SendCodeCommand 发送验证码命令
|
||
|
|
// @Description 发送短信验证码请求参数
|
||
|
|
type SendCodeCommand struct {
|
||
|
|
Phone string `json:"phone" binding:"required,len=11" example:"13800138000"`
|
||
|
|
Scene string `json:"scene" binding:"required,oneof=register login change_password reset_password bind unbind" example:"register"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateProfileCommand 更新用户信息命令
|
||
|
|
// @Description 更新用户基本信息请求参数
|
||
|
|
type UpdateProfileCommand struct {
|
||
|
|
UserID string `json:"-"`
|
||
|
|
Phone string `json:"phone" binding:"omitempty,len=11" example:"13800138000"`
|
||
|
|
// 可以在这里添加更多用户信息字段,如昵称、头像等
|
||
|
|
}
|
||
|
|
|
||
|
|
// VerifyCodeCommand 验证验证码命令
|
||
|
|
// @Description 验证短信验证码请求参数
|
||
|
|
type VerifyCodeCommand struct {
|
||
|
|
Phone string `json:"phone" binding:"required,len=11" example:"13800138000"`
|
||
|
|
Code string `json:"code" binding:"required,len=6" example:"123456"`
|
||
|
|
Scene string `json:"scene" binding:"required,oneof=register login change_password reset_password bind unbind" example:"register"`
|
||
|
|
}
|