send_smscode.go
655 字节
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
type SendSmsCodeCommand struct {
Phone string `json:"phone" valid:"Required"`
// 0:无 1:需要账号存在于账号系统内,才能发送验证码
Flag int `json:"flag"`
}
func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) {
}
func (orgAddCommand *SendSmsCodeCommand) 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
}