package command import ( "github.com/beego/beego/v2/core/validation" "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" ) type StateTemplateCommand struct { Id int64 `cname:"模板ID" json:"id,string" valid:"Required"` State int `cname:"模板状态" json:"state"` } type CopyTemplateCommand struct { Id int64 `cname:"模板ID" json:"id,string" valid:"Required"` } func (in *StateTemplateCommand) Valid(validation *validation.Validation) { switch in.State { case domain.TemplateStateWaitConfig, domain.TemplateStateWaitActive, domain.TemplateStateEnable, domain.TemplateStateDisable: default: validation.SetError("state", "状态设置错误") return } } func (in *CopyTemplateCommand) Valid(*validation.Validation) { }