94 lines
2.5 KiB
Go
94 lines
2.5 KiB
Go
package validator
|
|
|
|
import "lone-services/pkg/validate"
|
|
|
|
type AdminOrderAuditingItemsValidator struct {
|
|
Page int32
|
|
Size int32
|
|
Time []string
|
|
Status int32
|
|
}
|
|
|
|
// GetMessage 查看列表 - 提示消息
|
|
func (p AdminOrderAuditingItemsValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{}
|
|
}
|
|
|
|
type AdminOrderAuditingValidator struct {
|
|
Id int64 `validate:"required"`
|
|
Status int32 `validate:"required,oneof=1 2"`
|
|
Reason string `validate:"required_if=Status 2"`
|
|
}
|
|
|
|
// GetMessage 修改状态 - 提示消息
|
|
func (p AdminOrderAuditingValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Id.required": "ID不能为空",
|
|
"Status.required": "状态不能为空",
|
|
"Status.oneof": "状态传值不对",
|
|
"Reason.required_if": "理由不能为空",
|
|
}
|
|
}
|
|
|
|
type AdminOrderCreateValidator struct {
|
|
AddressId int64 `validate:"required"`
|
|
Info string `validate:"required"`
|
|
Note string
|
|
}
|
|
|
|
// GetMessage 修改状态 - 提示消息
|
|
func (p AdminOrderCreateValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"AddressId.required": "地址ID不能为空",
|
|
"Info.required": "内容不能为空",
|
|
}
|
|
}
|
|
|
|
type OrderCreateValidator struct {
|
|
AddressId int64 `validate:"required"`
|
|
Note string
|
|
Type int32 `validate:"required,oneof=1 2 3"` //类型 1门店 , 2销售,3为用户
|
|
}
|
|
|
|
func (p OrderCreateValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"AddressId.required": "地址ID不能为空",
|
|
"Type.required": "类型不能为空",
|
|
"Type.oneof": "类型不对",
|
|
}
|
|
}
|
|
|
|
type OrderOneCreateValidator struct {
|
|
AddressId int64 `validate:"required"`
|
|
Note string
|
|
ProductId int64 `validate:"required"`
|
|
Num int32 `validate:"required"`
|
|
Type int32 `validate:"required,oneof=1 2 3"` //类型 1门店 , 2销售,3为用户
|
|
}
|
|
|
|
func (p OrderOneCreateValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"AddressId.required": "地址ID不能为空",
|
|
"Type.required": "类型不能为空",
|
|
"Type.oneof": "类型不对",
|
|
"ProductId.required": "产品不能为空",
|
|
"Num.required": "产品数量不能为空",
|
|
}
|
|
}
|
|
|
|
type OrderItemsValidator struct {
|
|
Page int32
|
|
Size int32
|
|
ProductId int64
|
|
OrderSn string
|
|
Mobile string
|
|
StoreId int64
|
|
SaleId int64
|
|
Time []string
|
|
Status int32
|
|
}
|
|
|
|
func (p OrderItemsValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{}
|
|
}
|