exchange_su_money.go 748 字节
package command

import (
	"fmt"

	"github.com/astaxie/beego/validation"
)

type ExchangeSuMoneyCommand struct {
	Uid int64 `json:"uid" valid:"Required"`  									// 兑换人UID
	SuMoney float64 `json:"suMoney" valid:"Required"`    						// 素币值
	Operator int64 `json:"operator,omitempty"`   								// 操作人UID
	ExchangeDescription string `json:"exchangeDescription" valid:"Required"`   	// 兑换描述
}

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