template_option.go 934 字节
package command

import (
	"github.com/beego/beego/v2/core/validation"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)

type StateTemplateCommand struct {
	CompanyId int64 `cname:"公司ID" json:"companyId"`
	Id        int64 `cname:"模板ID" json:"id,string" valid:"Required"`
	State     int   `cname:"模板状态" json:"state"`
}

type CopyTemplateCommand struct {
	CompanyId int64 `cname:"公司ID" json:"companyId"`
	CreatorId int64 `cname:"创建人ID" json:"creatorId"`
	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) {

}