68 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package commands
 | |
| 
 | |
| // RegisterUserCommand 用户注册命令
 | |
| // @Description 用户注册请求参数
 | |
| type RegisterUserCommand struct {
 | |
| 	Phone           string `json:"phone" binding:"required,phone" example:"13800138000"`
 | |
| 	Password        string `json:"password" binding:"required,strong_password" 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,phone" example:"13800138000"`
 | |
| 	Password string `json:"password" binding:"required,min=6,max=128" example:"Password123"`
 | |
| }
 | |
| 
 | |
| // LoginWithSMSCommand 短信验证码登录命令
 | |
| // @Description 使用短信验证码进行用户登录请求参数
 | |
| type LoginWithSMSCommand struct {
 | |
| 	Phone string `json:"phone" binding:"required,phone" 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,min=6,max=128" example:"OldPassword123"`
 | |
| 	NewPassword        string `json:"new_password" binding:"required,strong_password" example:"NewPassword123"`
 | |
| 	ConfirmNewPassword string `json:"confirm_new_password" binding:"required,eqfield=NewPassword" example:"NewPassword123"`
 | |
| 	Code               string `json:"code" binding:"required,len=6" example:"123456"`
 | |
| }
 | |
| 
 | |
| // ResetPasswordCommand 重置密码命令
 | |
| // @Description 重置用户密码请求参数(忘记密码时使用)
 | |
| type ResetPasswordCommand struct {
 | |
| 	Phone              string `json:"phone" binding:"required,phone" example:"13800138000"`
 | |
| 	NewPassword        string `json:"new_password" binding:"required,strong_password" 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,phone" example:"13800138000"`
 | |
| 	Scene string `json:"scene" binding:"required,oneof=register login change_password reset_password bind unbind certification" example:"register"`
 | |
| }
 | |
| 
 | |
| // UpdateProfileCommand 更新用户信息命令
 | |
| // @Description 更新用户基本信息请求参数
 | |
| type UpdateProfileCommand struct {
 | |
| 	UserID      string `json:"-"`
 | |
| 	Phone       string `json:"phone" binding:"omitempty,phone" example:"13800138000"`
 | |
| 	DisplayName string `json:"display_name" binding:"omitempty,min=2,max=50" example:"用户昵称"`
 | |
| 	Email       string `json:"email" binding:"omitempty,email" example:"user@example.com"`
 | |
| }
 | |
| 
 | |
| // VerifyCodeCommand 验证验证码命令
 | |
| // @Description 验证短信验证码请求参数
 | |
| type VerifyCodeCommand struct {
 | |
| 	Phone string `json:"phone" binding:"required,phone" 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 certification" example:"register"`
 | |
| }
 |