update_cash_pool.go 831 字节
package command

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

type UpdateCashPoolCommand struct {
	CashPoolId int64 `json:"cashPoolId"`   // 现金池编号
	ExchangedCash float64 `json:"exchangedCash"`  // 已兑换现金
	ExchangedSuMoney float64 `json:"exchangedSuMoney"`  // 已兑换素币
	UnExchangeCash float64 `json:"unExchangeCash"`  // 未兑换现金
	UnExchangeSuMoney float64 `json:"unExchangedSuMoney"`  // 未兑换素币
	Rate float64 `json:"rate"`  // 平均兑换汇率
}

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