作者 yangfu

排行榜排名项修改

... ... @@ -28,7 +28,7 @@ type GetRankListRequest struct {
PageSize int `json:"pageSize" valid:"Required"` //每页数量
}
type GetRankListResponse struct {
SortItems []string `json:"sortItems"` //评比项
//SortItems []string `json:"sortItems"` //评比项
Self []RankItem `json:"self"` //自己或所在部门的排名分数
Lists [][]RankItem `json:"lists"` //排名列表
Total int `json:"total"` //总数
... ...
... ... @@ -15,28 +15,31 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
selfRank *protocol.RankItem
rankRange *models.RankRange
itemKeys []string
itemNames []string
//itemNames []string
departments []*models.Department
departmentId int64
hasDepartmentInRank bool = true
currentTotal int
)
rsp = &protocol.GetRankListResponse{
Self: make([]protocol.RankItem, 0),
Lists: make([][]protocol.RankItem, 0),
}
if rankRange, err = models.GetRankRangeById(request.RankRangeId); err != nil {
log.Error(err)
return
}
itemKeys = request.SortItemKeys
if len(itemKeys) == 0 {
if itemKeys, itemNames, err = models.GetRankItemKeys(header.CompanyId, request.RankTypeId); err != nil && err != orm.ErrNoRows {
if itemKeys, _, err = models.GetRankItemKeys(header.CompanyId, request.RankTypeId); err != nil && err != orm.ErrNoRows {
log.Error(err)
return
}
}
rsp = &protocol.GetRankListResponse{
Self: make([]protocol.RankItem, 0),
Lists: make([][]protocol.RankItem, 0),
if len(itemKeys) == 0 {
return
}
rsp.SortItems = itemNames
//rsp.SortItems = itemNames
if rankRange.Type == protocol.RankRangeTypeAllCompanyDepartment || rankRange.Type == protocol.RankRangeTypeAllSpecifyDepartment {
if departments, err = models.GetDepartmentByUser(header.UserId); err != nil {
log.Error(err)
... ...