53 lines
1009 B
Go
53 lines
1009 B
Go
package request
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
type UserSignUpRobotRequest struct {
|
|
Mobile string
|
|
Password string
|
|
Birthday string
|
|
NickName string
|
|
Gender string
|
|
Avatar string
|
|
VerificationCode string
|
|
SignupSource string // 注册来源 1=手机号 2=微信 3=QQ 4=H5 99=robot
|
|
}
|
|
|
|
// 注册用户信息签名验证
|
|
func (request *UserSignUpRobotRequest) CheckParameter() (err error) {
|
|
|
|
if len(request.SignupSource) == 0 {
|
|
err = errors.New("SignupSource不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.Mobile) == 0 {
|
|
err = errors.New("手机号不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.VerificationCode) == 0 {
|
|
err = errors.New("验证码不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.NickName) == 0 {
|
|
err = errors.New("昵称不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.Gender) == 0 {
|
|
err = errors.New("性别不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.NickName) > 30 {
|
|
err = errors.New("昵称长度不能超过30个字符")
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|