order apis
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package validator
|
||||
|
||||
import "lone-services/pkg/validate"
|
||||
|
||||
type EditValidator struct {
|
||||
Id int64 `validate:""`
|
||||
Name string `validate:"required"`
|
||||
TransitId int32 `validate:"required"`
|
||||
AppCode string `validate:"required"`
|
||||
AppSecretKey string `validate:"required"`
|
||||
AppUrl string `validate:"required"`
|
||||
CardNumber string `validate:"required"`
|
||||
Province string
|
||||
City string
|
||||
County string
|
||||
Address string
|
||||
CompanyName string
|
||||
Contact string
|
||||
Mobile string
|
||||
PdfCode string
|
||||
Other string
|
||||
}
|
||||
|
||||
// GetMessage 校验提示消息
|
||||
func (p EditValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Name.required": "请输入名称",
|
||||
"TransitId.required": "缺少快递ID",
|
||||
"AppCode.required": "请输入APP代码",
|
||||
"AppSecretKey.required": "请输入APP密钥",
|
||||
"AppUrl.required": "请输入接口地址",
|
||||
"CardNumber.required": "请输入月结卡号",
|
||||
}
|
||||
}
|
||||
|
||||
type StatusValidator struct {
|
||||
Id int64 `validate:"required"`
|
||||
Status int32 `validate:"required,oneof=1 2"`
|
||||
Reason string `validate:"required_if=Status 2"`
|
||||
}
|
||||
|
||||
// GetMessage 修改状态 - 提示消息
|
||||
func (p StatusValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Id.required": "ID不能为空",
|
||||
"Status.required": "状态不能为空",
|
||||
"Status.oneof": "状态传值不对",
|
||||
"Reason.required_if": "理由不能为空",
|
||||
}
|
||||
}
|
||||
|
||||
type InfoValidator struct {
|
||||
Id int64 `validate:"required"`
|
||||
}
|
||||
|
||||
func (p InfoValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Id.required": "ID不能为空",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user