create_list_interval.go 706 字节
package command

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

type CreateListIntervalCommand struct {
	CompanyId int64 `json:"companyId" valid:"Required"`   // 公司id
	ListIntervalStartTime time.Time `json:"listIntervalStartTime"`  // 排行榜开始时间
	ListIntervalEndTime time.Time `json:"listIntervalEndTime"` // 排行榜结束时间
}

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