b77a1f1b95
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 32s
CI / admin (push) Successful in 26s
CI / analysis (push) Successful in 28s
CI / bff (push) Successful in 23s
CI / chore (push) Successful in 24s
CI / equipment (push) Successful in 21s
CI / express (push) Successful in 21s
CI / factory (push) Successful in 18s
CI / message (push) Successful in 18s
CI / order (push) Successful in 21s
CI / payment (push) Successful in 20s
CI / percutaneous (push) Successful in 19s
CI / product (push) Successful in 21s
CI / record (push) Successful in 21s
CI / sale (push) Successful in 20s
CI / store (push) Successful in 25s
CI / support (push) Successful in 21s
CI / task (push) Successful in 20s
CI / user (push) Successful in 22s
CI / water (push) Successful in 20s
CI / wecom (push) Successful in 21s
CI / ws (push) Successful in 8s
228 lines
6.0 KiB
Go
228 lines
6.0 KiB
Go
package validator
|
|
|
|
import "lone-services/pkg/validate"
|
|
|
|
type UserImproveValidator struct {
|
|
Avatar string
|
|
Name string
|
|
Birthday string
|
|
Mobile string
|
|
Gender int32 `validate:"omitempty,oneof=0 1 2 3"`
|
|
Password string
|
|
}
|
|
|
|
func (p UserImproveValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Gender.oneof": "性别不正确",
|
|
}
|
|
}
|
|
|
|
type FaceBindValidator struct {
|
|
FacePath string `validate:"required,max=512"`
|
|
}
|
|
|
|
func (p FaceBindValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"FacePath.required": "face_path 不能为空",
|
|
"FacePath.max": "face_path 过长",
|
|
}
|
|
}
|
|
|
|
type AgreementInfoValidator struct {
|
|
Type int32 `validate:"required,gt=0"`
|
|
}
|
|
|
|
func (p AgreementInfoValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Type.required": "type 必传",
|
|
"Type.gt": "type 必传",
|
|
}
|
|
}
|
|
|
|
type UserDeleteValidator struct {
|
|
Id int64 `validate:"required,gt=0"`
|
|
}
|
|
|
|
func (p UserDeleteValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Id.required": "id 不能为空",
|
|
"Id.gt": "id 必须大于0",
|
|
}
|
|
}
|
|
|
|
type SwitchValidator struct {
|
|
Type int32 `validate:"omitempty,gte=0"`
|
|
}
|
|
|
|
func (p SwitchValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{}
|
|
}
|
|
|
|
type QrcodeInfoValidator struct {
|
|
Id int64 `validate:"required,gt=0"`
|
|
}
|
|
|
|
func (p QrcodeInfoValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Id.required": "id 必传",
|
|
"Id.gt": "id 必传",
|
|
}
|
|
}
|
|
|
|
type StoreAuthValidator struct {
|
|
Username string `validate:"required,max=32"`
|
|
Password string `validate:"required,max=64"`
|
|
ValidityTime string `validate:"required,max=32"`
|
|
}
|
|
|
|
func (p StoreAuthValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Username.required": "账号必传",
|
|
"Username.max": "账号过长",
|
|
"Password.required": "密码必传",
|
|
"Password.max": "密码过长",
|
|
"ValidityTime.required": "有效时间必传",
|
|
"ValidityTime.max": "有效时间过长",
|
|
}
|
|
}
|
|
|
|
type UserAuthValidator struct {
|
|
Type int32 `validate:"required,oneof=1 2"`
|
|
StoreId int64 `validate:"required,gt=0"`
|
|
ValidityTime string `validate:"required_if=Type 1,omitempty,max=32"`
|
|
}
|
|
|
|
func (p UserAuthValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Type.required": "类型必传",
|
|
"Type.oneof": "类型只能是1或2",
|
|
"StoreId.required": "门店id必传",
|
|
"StoreId.gt": "门店id必传",
|
|
"ValidityTime.required": "有效时间必传",
|
|
"ValidityTime.max": "有效时间过长",
|
|
}
|
|
}
|
|
|
|
type UserAuthDeleteValidator struct {
|
|
Id int64 `validate:"required,gt=0"`
|
|
}
|
|
|
|
func (p UserAuthDeleteValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Id.required": "id 不能为空",
|
|
"Id.gt": "id 必须大于0",
|
|
}
|
|
}
|
|
|
|
type DeviceBindValidator struct {
|
|
DeviceNo string `validate:"required,max=64"`
|
|
}
|
|
|
|
func (p DeviceBindValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"DeviceNo.required": "device_no 必传",
|
|
"DeviceNo.max": "device_no 过长",
|
|
}
|
|
}
|
|
|
|
type DevicePolicyValidator struct {
|
|
SerialNo string `validate:"required,max=64"`
|
|
}
|
|
|
|
func (p DevicePolicyValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"SerialNo.required": "serial_no 必传",
|
|
"SerialNo.max": "serial_no 过长",
|
|
}
|
|
}
|
|
|
|
type DeviceDisplayValidator struct {
|
|
TaskId string `validate:"required,max=64"`
|
|
}
|
|
|
|
func (p DeviceDisplayValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"TaskId.required": "task_id 必传",
|
|
"TaskId.max": "task_id 过长",
|
|
}
|
|
}
|
|
|
|
type PyCallbackValidator struct {
|
|
TaskId string `validate:"required,max=64"`
|
|
}
|
|
|
|
func (p PyCallbackValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"TaskId.required": "task_id 必传",
|
|
"TaskId.max": "task_id 过长",
|
|
}
|
|
}
|
|
|
|
type StoreInfoValidator struct {
|
|
Id int64 `validate:"required,gt=0"`
|
|
}
|
|
|
|
func (p StoreInfoValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Id.required": "id 必传",
|
|
"Id.gt": "id 必传",
|
|
}
|
|
}
|
|
|
|
type StoreUserListValidator struct {
|
|
Gender int32 `validate:"omitempty,oneof=0 1 2 3"`
|
|
AgeMin int32 `validate:"omitempty,gte=0"`
|
|
AgeMax int32 `validate:"omitempty,gte=0"`
|
|
Page int32 `validate:"omitempty,gte=0"`
|
|
Size int32 `validate:"omitempty,gte=0,lte=100"`
|
|
}
|
|
|
|
func (p StoreUserListValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Gender.oneof": "性别不正确",
|
|
"Size.lte": "每页数量过大",
|
|
}
|
|
}
|
|
|
|
type StoreUserUpdateValidator struct {
|
|
UserId int64 `validate:"required,gt=0"`
|
|
Gender *int32 `validate:"omitempty,oneof=0 1 2 3"`
|
|
Name *string `validate:"omitempty,max=64"`
|
|
Birthday *string `validate:"omitempty,max=32"`
|
|
}
|
|
|
|
func (p StoreUserUpdateValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"UserId.required": "user_id 必传",
|
|
"UserId.gt": "user_id 必传",
|
|
"Gender.oneof": "性别不正确",
|
|
"Name.max": "名称过长",
|
|
"Birthday.max": "生日过长",
|
|
}
|
|
}
|
|
|
|
type StoreUserInfoValidator struct {
|
|
UserId int64 `validate:"required,gt=0"`
|
|
}
|
|
|
|
func (p StoreUserInfoValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"UserId.required": "user_id 必传",
|
|
"UserId.gt": "user_id 必传",
|
|
}
|
|
}
|
|
|
|
type UserAuthUpdateValidator struct {
|
|
Id int64 `validate:"required,gt=0"`
|
|
ValidityTime string `validate:"required,max=32"`
|
|
}
|
|
|
|
func (p UserAuthUpdateValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Id.required": "id 不能为空",
|
|
"Id.gt": "id 必须大于0",
|
|
"ValidityTime.required": "时间必传",
|
|
"ValidityTime.max": "时间过长",
|
|
}
|
|
}
|