search_exchange_cash_activity.go 935 字节
package command

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

type SearchExchangeCashActivityCommand struct {
	ActivityNameMatch             string `json:"activityNameMatch"` // 兑换现金活动名称
	CompanyId 						int64 						`json:"companyId"`   // 公司id
	Deadline                        string                   `json:"deadline,omitempty"`   // 截止时间筛选
	Offset                      	int    						`json:"offset,omitempty"`   // 查询偏移量
	Limit                       	int    						`json:"limit,omitempty"`  // 查询限制条目
}

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