|
@@ -15,28 +15,31 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe |
|
@@ -15,28 +15,31 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe |
|
15
|
selfRank *protocol.RankItem
|
15
|
selfRank *protocol.RankItem
|
|
16
|
rankRange *models.RankRange
|
16
|
rankRange *models.RankRange
|
|
17
|
itemKeys []string
|
17
|
itemKeys []string
|
|
18
|
- itemNames []string
|
18
|
+ //itemNames []string
|
|
19
|
departments []*models.Department
|
19
|
departments []*models.Department
|
|
20
|
departmentId int64
|
20
|
departmentId int64
|
|
21
|
hasDepartmentInRank bool = true
|
21
|
hasDepartmentInRank bool = true
|
|
22
|
currentTotal int
|
22
|
currentTotal int
|
|
23
|
)
|
23
|
)
|
|
|
|
24
|
+ rsp = &protocol.GetRankListResponse{
|
|
|
|
25
|
+ Self: make([]protocol.RankItem, 0),
|
|
|
|
26
|
+ Lists: make([][]protocol.RankItem, 0),
|
|
|
|
27
|
+ }
|
|
24
|
if rankRange, err = models.GetRankRangeById(request.RankRangeId); err != nil {
|
28
|
if rankRange, err = models.GetRankRangeById(request.RankRangeId); err != nil {
|
|
25
|
log.Error(err)
|
29
|
log.Error(err)
|
|
26
|
return
|
30
|
return
|
|
27
|
}
|
31
|
}
|
|
28
|
itemKeys = request.SortItemKeys
|
32
|
itemKeys = request.SortItemKeys
|
|
29
|
if len(itemKeys) == 0 {
|
33
|
if len(itemKeys) == 0 {
|
|
30
|
- if itemKeys, itemNames, err = models.GetRankItemKeys(header.CompanyId, request.RankTypeId); err != nil && err != orm.ErrNoRows {
|
34
|
+ if itemKeys, _, err = models.GetRankItemKeys(header.CompanyId, request.RankTypeId); err != nil && err != orm.ErrNoRows {
|
|
31
|
log.Error(err)
|
35
|
log.Error(err)
|
|
32
|
return
|
36
|
return
|
|
33
|
}
|
37
|
}
|
|
34
|
}
|
38
|
}
|
|
35
|
- rsp = &protocol.GetRankListResponse{
|
|
|
|
36
|
- Self: make([]protocol.RankItem, 0),
|
|
|
|
37
|
- Lists: make([][]protocol.RankItem, 0),
|
39
|
+ if len(itemKeys) == 0 {
|
|
|
|
40
|
+ return
|
|
38
|
}
|
41
|
}
|
|
39
|
- rsp.SortItems = itemNames
|
42
|
+ //rsp.SortItems = itemNames
|
|
40
|
if rankRange.Type == protocol.RankRangeTypeAllCompanyDepartment || rankRange.Type == protocol.RankRangeTypeAllSpecifyDepartment {
|
43
|
if rankRange.Type == protocol.RankRangeTypeAllCompanyDepartment || rankRange.Type == protocol.RankRangeTypeAllSpecifyDepartment {
|
|
41
|
if departments, err = models.GetDepartmentByUser(header.UserId); err != nil {
|
44
|
if departments, err = models.GetDepartmentByUser(header.UserId); err != nil {
|
|
42
|
log.Error(err)
|
45
|
log.Error(err)
|