create_exchange_cash_person.go 961 字节
package command

import (
	"fmt"
	"github.com/astaxie/beego/validation"
)

type CreateExchangeCashPersonCommand struct {
	PersonId int64   `json:"personId" valid:"Required"`  // 兑换现金人员uid
	PersonName string `json:"personName,omitempty"`  // 兑换现金人员名称
	PersonAccount  string `json:"personAccount,omitempty"` // 手机账号
	ExchangeCashActivityId int64 `json:"exchangeCashActivityId" valid:"Required"`  // 参与的兑换活动id
	ExchangedSuMoney float64 `json:"exchangedSuMoney"`  // 已兑换素币值
	//ExchangedCash float64 `json:"exchangedCash"`  // 已兑换现金值
}

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