update_exchange_cash_person.go
904 字节
package command
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type UpdateExchangeCashPersonCommand struct {
ExchangeCashPersonId int64 `json:"exchangeCashPersonId" valid:"Required"` // 兑换现金人员编号
ExchangedSuMoney float64 `json:"exchangedSuMoney"` // 已兑换的素币(需要和当前的已兑换素币进行比较,少于当前已兑换素币则生成一条扣除素币记录,大于当前已兑换素币则生成一条增加素币记录)
ExchangedCash float64 `json:"exchangedCash"` // 已兑换的现金
}
func (updateExchangeCashPersonCommand *UpdateExchangeCashPersonCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateExchangeCashPersonCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}