update_cash_pool.go 1.0 KB
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:"unExchangeSuMoney"`  // 未兑换素币
	Rate 				float64   `json:"rate"`  		// 平均兑换汇率
	Cash                float64   `json:"cash"`
	//CompanyId           int64     `json:"companyId"`
	LastRate            float64   `json:"lastRate"`
	//CreateTime          time.Time `json:"createTime"`
}

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
}