eb96aaa2ef
CI / changes (push) Successful in 37s
CI / ad (push) Successful in 44s
CI / admin (push) Successful in 39s
CI / bff (push) Successful in 32s
CI / chore (push) Successful in 38s
CI / express (push) Successful in 42s
CI / product (push) Successful in 43s
CI / sale (push) Successful in 42s
CI / task (push) Successful in 42s
CI / user (push) Successful in 42s
CI / wecom (push) Successful in 41s
66 lines
2.2 KiB
Go
66 lines
2.2 KiB
Go
package validator
|
|
|
|
import "lone-services/pkg/validate"
|
|
|
|
type TaskCreateValidator struct {
|
|
Type int32 `form:"type" json:"type" validate:"required"`
|
|
Time int32 `form:"time" json:"time" validate:"required"`
|
|
ProductId int64 `form:"product_id" json:"product_id" validate:"required"`
|
|
Province int64 `form:"province" json:"province" validate:"required"`
|
|
ProvinceName string `form:"province_name" json:"province_name" validate:"required"`
|
|
Task int32 `form:"task" json:"task" validate:"required"`
|
|
Award float64 `form:"award" json:"award" validate:"required"`
|
|
}
|
|
|
|
// GetMessage 提示消息
|
|
func (p TaskCreateValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
"Type.required": "类型不能为空",
|
|
"Time.required": "时间不能为空",
|
|
"ProductId.required": "产品ID不能为空",
|
|
"Province.required": "省份不能为空",
|
|
"ProvinceName.required": "省份名不能为空",
|
|
"Task.required": "任务不能为空",
|
|
"Award.required": "奖励不能为空",
|
|
}
|
|
}
|
|
|
|
type TaskEditValidator struct {
|
|
Id int64 `form:"id" json:"id" validate:"required"`
|
|
Task int32 `form:"task" json:"task" validate:"required"`
|
|
Award float64 `form:"award" json:"award" validate:"required"`
|
|
}
|
|
|
|
// GetMessage 提示消息
|
|
func (p TaskEditValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{
|
|
validate.FieldId: validate.FieldIdValue,
|
|
"Task.required": "任务不能为空",
|
|
"Award.required": "奖励不能为空",
|
|
}
|
|
}
|
|
|
|
type TaskItemsValidator struct {
|
|
Page int32 `form:"page" json:"page"`
|
|
Size int32 `form:"size" json:"size"`
|
|
}
|
|
|
|
// GetMessage 提示消息
|
|
func (p TaskItemsValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{}
|
|
}
|
|
|
|
type TaskAccountItemsValidator struct {
|
|
Name string `form:"name" json:"name"`
|
|
Page int32 `form:"page" json:"page"`
|
|
Size int32 `form:"size" json:"size"`
|
|
Type int32 `form:"type" json:"type"`
|
|
Time int32 `form:"time" json:"time"`
|
|
Month string `form:"month" json:"month"`
|
|
}
|
|
|
|
// GetMessage 提示消息
|
|
func (p TaskAccountItemsValidator) GetMessage() validate.ValidatorMessages {
|
|
return validate.ValidatorMessages{}
|
|
}
|