feat: user items
This commit is contained in:
@@ -54,3 +54,30 @@ func (p LoginValidator) GetMessage() validate.ValidatorMessages {
|
||||
"Openid.required": "Openid不能为空",
|
||||
}
|
||||
}
|
||||
|
||||
type UserItemsValidator struct {
|
||||
Mobile string
|
||||
Page int32 `validate:"omitempty,min=1"`
|
||||
Size int32 `validate:"omitempty,min=1,max=100"`
|
||||
}
|
||||
|
||||
func (p UserItemsValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Page.min": "页码最小为1",
|
||||
"Size.min": "每页数量最小为1",
|
||||
"Size.max": "每页数量最大为100",
|
||||
}
|
||||
}
|
||||
|
||||
type UserStatusValidator struct {
|
||||
Id int64 `validate:"required"`
|
||||
Status int32 `validate:"required,oneof=1 2"`
|
||||
}
|
||||
|
||||
func (p UserStatusValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Id.required": "用户ID不能为空",
|
||||
"Status.required": "状态不能为空",
|
||||
"Status.oneof": "状态传值不对",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user