contributions_wealth_ranking.go 1.0 KB
package query

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

type ContributionsWealthRankingQuery struct {
	CompanyId int64 `json:"companyId" valid:"Required"`  	// 公司ID
	RankingType int `json:"rankingType" valid:"Required"`  	// 榜单类型,区分总榜和年榜 1:总榜,2:年榜
  	Offset int `json:"offset,omitempty"`  					// 查询偏离量
	Limit int `json:"limit,omitempty"`   					// 查询限制
	Uid int64 `json:"uid" valid:"Required"` 			    // 统一用户id
	StartTime time.Time `json:"startTime"`  				// 榜单开始时间,由后台根据榜单类型后去
	EndTime   time.Time `json:"endTime"`    				// 榜单结束更新,由后台根据榜单类型获取
}

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