42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package validator
|
|
|
|
import "lone-services/pkg/validate"
|
|
|
|
type CodeBindValidator struct {
|
|
Code string `form:"code" json:"code" validate:"required"`
|
|
StoreId int64 `form:"store_id" json:"store_id" validate:"required"`
|
|
}
|
|
|
|
// GetMessage 提示消息
|
|
func (p CodeBindValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Code.required": "验证码不能为空",
|
|
"StoreId.required": "门店ID不能为空",
|
|
}
|
|
}
|
|
|
|
type CancelBindValidator struct {
|
|
StoreId int64 `form:"store_id" json:"store_id" validate:"required"`
|
|
}
|
|
|
|
// GetMessage 提示消息
|
|
func (p CancelBindValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"StoreId.required": "门店ID不能为空",
|
|
}
|
|
}
|
|
|
|
type ControlBindValidator struct {
|
|
StoreId int64 `form:"store_id" json:"store_id" validate:"required"`
|
|
Open int32 `form:"open" json:"open" validate:"required,oneof:1 2"`
|
|
}
|
|
|
|
// GetMessage 提示消息
|
|
func (p ControlBindValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"StoreId.required": "门店ID不能为空",
|
|
"Open.required": "开启展示不能为空",
|
|
"Open.oneof": "开启展示只能是1或2",
|
|
}
|
|
}
|