company_sign_up.go
824 字节
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
type CompanySignUpCommand struct {
CompanyName string `json:"companyName"`
Contacts string `json:"contacts"`
IndustryCategory string `json:"industryCategory"`
Password string `json:"password"`
Phone string `json:"phone"`
Scale string `json:"scale"`
SmsCode string `json:"smsCode"`
}
func (orgAddCommand *CompanySignUpCommand) Valid(validation *validation.Validation) {
}
func (orgAddCommand *CompanySignUpCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(orgAddCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}