feat: user info

This commit is contained in:
zzw
2026-10-19 17:30:45 +08:00
parent 46d3f672bf
commit 8d7b543dc2
57 changed files with 2836 additions and 251 deletions
+37
View File
@@ -60,6 +60,26 @@ func (p LoginValidator) GetMessage() validate.ValidatorMessages {
}
}
type UpdateValidator struct {
Name string `validate:"omitempty,max=64"`
Avatar string `validate:"omitempty,max=512"`
Gender uint32 `validate:"omitempty,oneof=0 1 2 3"`
Birthday string `validate:"omitempty,max=32"`
Mobile string `validate:"omitempty,len=11"`
RealName string `validate:"omitempty,max=64"`
}
func (p UpdateValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Name.max": "昵称过长",
"Avatar.max": "头像地址过长",
"Gender.oneof": "性别不正确",
"Birthday.max": "生日过长",
"Mobile.len": "手机号格式不正确",
"RealName.max": "真实姓名过长",
}
}
type PasswordValidator struct {
OldPassword string `validate:"required,max=64"`
Password string `validate:"required,min=6,max=64"`
@@ -152,6 +172,23 @@ func (p InternalGetUserInfoValidator) GetMessage() validate.ValidatorMessages {
}
}
type InternalUsersByBizValidator struct {
ClientCode string `validate:"required,max=64"`
BizIds []int64 `validate:"omitempty,dive,gt=0"`
Keyword string `validate:"omitempty,max=64"`
Gender uint32 `validate:"omitempty,oneof=0 1 2 3"`
BirthdayGte string `validate:"omitempty,max=32"`
BirthdayLte string `validate:"omitempty,max=32"`
}
func (p InternalUsersByBizValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"ClientCode.required": "客户端不能为空",
"ClientCode.max": "客户端过长",
"Gender.oneof": "性别不正确",
}
}
type InternalUsersByIdsValidator struct {
Ids []int64 `validate:"required,min=1,dive,gt=0"`
}