service apis edit, info, items, status, names
CI / changes (push) Successful in 2s
CI / docker-bff (push) Successful in 1s
CI / docker-product (push) Has been skipped

This commit is contained in:
2026-08-11 10:35:29 +08:00
parent afc8e18635
commit 44c4aed22e
16 changed files with 930 additions and 82 deletions
+46
View File
@@ -0,0 +1,46 @@
package validator
import (
"pkg.local/validate"
)
// ServiceEditValidator 创建/编辑
type ServiceEditValidator struct {
Name string `validate:"required"`
}
// GetMessage 创建 - 提示消息
func (p ServiceEditValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Name.required": "名称不能为空",
}
}
// ServiceInfoValidator 查看信息
type ServiceInfoValidator struct {
Id int64 `validate:"required"`
}
// GetMessage 查看信息 - 提示消息
func (p ServiceInfoValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Id.required": "ID不能为空",
}
}
// ServiceStatusValidator 修改状态
type ServiceStatusValidator struct {
Id int64 `validate:"required"`
Status int32 `validate:"required,oneof=1 2"`
Reason string `validate:"required_if=Status 2"`
}
// GetMessage 修改状态 - 提示消息
func (p ServiceStatusValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Id.required": "ID不能为空",
"Status.required": "状态不能为空",
"Status.oneof": "状态传值不对",
"Reason.required_if": "理由不能为空",
}
}