package query import ( "fmt" "github.com/beego/beego/v2/core/validation" "net/http" ) type GetLatestVersionQuery struct { //操作人 //操作人 //Operator domain.Operator `json:"-"` DeviceType string `json:"-"` VersionNo int `json:"versionNo,string"` Channel int `json:"channel"` AppName string `json:"appName"` Request *http.Request `json:"-"` } func (departmentsUsersQuery *GetLatestVersionQuery) Valid(validation *validation.Validation) { } func (departmentsUsersQuery *GetLatestVersionQuery) ValidateQuery() error { valid := validation.Validation{} b, err := valid.Valid(departmentsUsersQuery) if err != nil { return err } if !b { for _, validErr := range valid.Errors { return fmt.Errorf("%s %s", validErr.Key, validErr.Message) } } return nil }