access_token.go 593 字节
package command

import (
	"fmt"

	"github.com/beego/beego/v2/core/validation"
)

type AccessTokenCommand struct {
	// Attribute描述
	AuthCode string `json:"authCode,omitempty"`
}

func (accessTokenCommand *AccessTokenCommand) Valid(validation *validation.Validation) {

}

func (accessTokenCommand *AccessTokenCommand) ValidateCommand() error {
	valid := validation.Validation{}
	b, err := valid.Valid(accessTokenCommand)
	if err != nil {
		return err
	}
	if !b {
		for _, validErr := range valid.Errors {
			return fmt.Errorf("%s  %s", validErr.Key, validErr.Message)
		}
	}
	return nil
}