create_exchange_cash_person.go 858 字节
package command

import (
	"fmt"
	"github.com/astaxie/beego/validation"
	"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
)

type CreateExchangeCashPersonCommand struct {
	ExchangeCashPerson *domain.Employee  `json:"exchangeCashPerson"`  // 兑换现金人员
	ExchangeCashActivityId int64 `json:"exchangeCashActivityId"`  // 参与的兑换活动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
}