feat: rebind mobile
CI / changes (push) Successful in 1m57s
CI / ad (push) Successful in 1s
CI / admin (push) Successful in 0s
CI / bff (push) Successful in 26s
CI / chore (push) Successful in 26s
CI / equipment (push) Successful in 0s
CI / express (push) Successful in 0s
CI / factory (push) Successful in 0s
CI / message (push) Successful in 0s
CI / order (push) Successful in 1s
CI / payment (push) Successful in 0s
CI / percutaneous (push) Successful in 1s
CI / product (push) Successful in 0s
CI / record (push) Successful in 1s
CI / sale (push) Successful in 0s
CI / support (push) Successful in 0s
CI / task (push) Successful in 0s
CI / user (push) Successful in 28s
CI / water (push) Successful in 0s
CI / wecom (push) Successful in 0s

This commit is contained in:
zzw
2026-10-21 14:21:19 +08:00
parent 8db28b074a
commit 3517713853
10 changed files with 327 additions and 106 deletions
+23 -9
View File
@@ -67,19 +67,16 @@ type UpdateValidator struct {
Birthday string `validate:"omitempty,max=32"`
Mobile string `validate:"omitempty,len=11"`
RealName string `validate:"omitempty,max=64"`
SmsCode string `validate:"required_with=Mobile,omitempty,max=8"`
}
func (p UpdateValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Name.max": "昵称过长",
"Avatar.max": "头像地址过长",
"Gender.oneof": "性别不正确",
"Birthday.max": "生日过长",
"Mobile.len": "手机号格式不正确",
"RealName.max": "真实姓名过长",
"SmsCode.required_with": "修改手机号时验证码不能为空",
"SmsCode.max": "验证码过长",
"Name.max": "昵称过长",
"Avatar.max": "头像地址过长",
"Gender.oneof": "性别不正确",
"Birthday.max": "生日过长",
"Mobile.len": "手机号格式不正确",
"RealName.max": "真实姓名过长",
}
}
@@ -120,6 +117,23 @@ func (p BindMobileValidator) GetMessage() validate.ValidatorMessages {
}
}
type RebindMobileValidator struct {
OldMobile string `validate:"required,len=11"`
NewMobile string `validate:"required,len=11"`
SmsCode string `validate:"required,max=8"`
}
func (p RebindMobileValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"OldMobile.required": "原手机号不能为空",
"OldMobile.len": "原手机号格式不正确",
"NewMobile.required": "新手机号不能为空",
"NewMobile.len": "新手机号格式不正确",
"SmsCode.required": "验证码不能为空",
"SmsCode.max": "验证码过长",
}
}
type UserItemsValidator struct {
Mobile string
Page int32 `validate:"omitempty,min=1"`