fix: wecom user list
CI / admin (push) Has been skipped
CI / bff (push) Has been skipped
CI / chore (push) Has been skipped
CI / express (push) Has been skipped
CI / product (push) Has been skipped
CI / sale (push) Has been skipped
CI / user (push) Has been skipped
CI / wecom (push) Has been skipped
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 0s
CI / admin (push) Has been skipped
CI / bff (push) Has been skipped
CI / chore (push) Has been skipped
CI / express (push) Has been skipped
CI / product (push) Has been skipped
CI / sale (push) Has been skipped
CI / user (push) Has been skipped
CI / wecom (push) Has been skipped
CI / changes (push) Successful in 12s
CI / ad (push) Successful in 0s
This commit is contained in:
@@ -3,37 +3,42 @@ package validator
|
||||
import "lone-services/pkg/validate"
|
||||
|
||||
type CreateUserValidator struct {
|
||||
UserId int64 `validate:"required,min=1"`
|
||||
Type uint32 `validate:"required,oneof=1 2"`
|
||||
Name string `validate:"required,max=64"`
|
||||
Mobile string `validate:"required,mobile"`
|
||||
Avatar string `validate:"omitempty,max=1024"`
|
||||
Status uint32 `validate:"omitempty,oneof=1 2"`
|
||||
UserId int64 `validate:"required,min=1"`
|
||||
Type uint32 `validate:"required,oneof=1 2"`
|
||||
Name string `validate:"required,max=64"`
|
||||
Mobile string `validate:"required,mobile"`
|
||||
Avatar string `validate:"omitempty,max=1024"`
|
||||
Status uint32 `validate:"omitempty,oneof=1 2"`
|
||||
AgentIds []int64 `validate:"required,min=1,dive,gt=0"`
|
||||
}
|
||||
|
||||
func (p CreateUserValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"UserId.required": "业务用户ID不能为空",
|
||||
"UserId.min": "业务用户ID无效",
|
||||
"Type.required": "类型不能为空",
|
||||
"Type.oneof": "类型不对,1:管理员 2:销售",
|
||||
"Name.required": "姓名不能为空",
|
||||
"Name.max": "姓名长度不能超过64",
|
||||
"Mobile.required": "手机号不能为空",
|
||||
"Mobile.mobile": "手机号格式错误",
|
||||
"Avatar.max": "头像长度不能超过1024",
|
||||
"Status.oneof": "状态不对,1:启用 2:禁用",
|
||||
"UserId.required": "业务用户ID不能为空",
|
||||
"UserId.min": "业务用户ID无效",
|
||||
"Type.required": "类型不能为空",
|
||||
"Type.oneof": "类型不对,1:管理员 2:销售",
|
||||
"Name.required": "姓名不能为空",
|
||||
"Name.max": "姓名长度不能超过64",
|
||||
"Mobile.required": "手机号不能为空",
|
||||
"Mobile.mobile": "手机号格式错误",
|
||||
"Avatar.max": "头像长度不能超过1024",
|
||||
"Status.oneof": "状态不对,1:启用 2:禁用",
|
||||
"AgentIds.required": "应用不能为空",
|
||||
"AgentIds.min": "至少选择一个应用",
|
||||
"AgentIds.gt": "应用ID无效",
|
||||
}
|
||||
}
|
||||
|
||||
type UpdateUserValidator struct {
|
||||
Id int64 `validate:"omitempty,min=1"`
|
||||
UserId int64 `validate:"omitempty,min=1"`
|
||||
Type uint32 `validate:"omitempty,oneof=1 2"`
|
||||
Name string `validate:"omitempty,max=64"`
|
||||
Mobile string `validate:"omitempty,mobile"`
|
||||
Avatar string `validate:"omitempty,max=1024"`
|
||||
Status uint32 `validate:"omitempty,oneof=1 2"`
|
||||
Id int64 `validate:"omitempty,min=1"`
|
||||
UserId int64 `validate:"omitempty,min=1"`
|
||||
Type uint32 `validate:"omitempty,oneof=1 2"`
|
||||
Name string `validate:"omitempty,max=64"`
|
||||
Mobile string `validate:"omitempty,mobile"`
|
||||
Avatar string `validate:"omitempty,max=1024"`
|
||||
Status uint32 `validate:"omitempty,oneof=1 2"`
|
||||
AgentIds []int64 `validate:"omitempty,dive,gt=0"`
|
||||
}
|
||||
|
||||
func (p UpdateUserValidator) GetMessage() validate.ValidatorMessages {
|
||||
@@ -45,6 +50,7 @@ func (p UpdateUserValidator) GetMessage() validate.ValidatorMessages {
|
||||
"Mobile.mobile": "手机号格式错误",
|
||||
"Avatar.max": "头像长度不能超过1024",
|
||||
"Status.oneof": "状态不对,1:启用 2:禁用",
|
||||
"AgentIds.gt": "应用ID无效",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user