update_exchange_cash_activity.go 1.2 KB
package command

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

type UpdateExchangeCashActivityCommand struct {
	ExchangeCashActivityId int64                        `json:"exchangeCashActivityId"`     // 兑换现金活动id
	ExchangeActivityName string                         `json:"exchangeActivityName"`       // 活动名称
	Deadline time.Time                                  `json:"deadline"`                   // 活动截止时间
	CountDown int64                                     `json:"countDown"`                  // 活动倒计时
	ExchangedSuMoney float64                            `json:"exchangedSuMoney"`           // 已兑换素币
	ExchangedCash float64                               `json:"exchangedCash"`              // 已兑换现金
	ExchangeRate float64                                `json:"exchangeRate"`               // 兑换汇率
}

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