Merge branch 'develop' of git.ailuowan.com:zzw/lone-services into develop

This commit is contained in:
zzw
2026-09-02 17:51:53 +08:00
50 changed files with 2990 additions and 99 deletions
+37
View File
@@ -0,0 +1,37 @@
package validate
const (
FieldId = "Id.required"
FieldIdValue = "ID不能为空"
FieldStatus = "Status.required"
FieldStatusValue = "状态不能为空"
FieldTypeIn = "Type.oneof"
FieldTypeInValue = "类型传值不对"
FieldType = "Type.required"
FieldTypeValue = "类型不能为空"
)
type StatusValidator struct {
Id int64 `form:"id" json:"id" validate:"required"`
Status int32 `form:"status" json:"status" validate:"required"`
Reason string `form:"reason" json:"reason" validate:"required_if=Status 2"`
}
func (p StatusValidator) GetMessage() ValidatorMessages {
return ValidatorMessages{
FieldId: FieldIdValue,
FieldStatus: FieldStatusValue,
"Reason.required_if": "禁用状态,理由不能为空",
}
}
type InfoValidator struct {
Id int64 `form:"id" json:"id" validate:"required"`
}
// GetMessage 提示消息
func (p InfoValidator) GetMessage() ValidatorMessages {
return ValidatorMessages{
FieldId: FieldIdValue,
}
}