create_exchange_cash_activity.go 1007 字节
package command

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

// 创建现金兑换活动
type CreateExchangeCashActivityCommand struct {
	CompanyId int64                                     `json:"companyId" valid:"Required"` // 公司id
	ExchangeActivityName string                         `json:"exchangeActivityName"`       // 活动名称
	Deadline time.Time                                  `json:"deadline"`                   // 活动截止时间
	ExchangeRate float64                                `json:"exchangeRate"`               // 兑换汇率
	CreateTime time.Time 								`json:"createTime"`					// 创建时间
}

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