作者 yangfu

排行榜列表修改

@@ -19,6 +19,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe @@ -19,6 +19,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
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 ) 23 )
23 if rankRange, err = models.GetRankRangeById(request.RankRangeId); err != nil { 24 if rankRange, err = models.GetRankRangeById(request.RankRangeId); err != nil {
24 log.Error(err) 25 log.Error(err)
@@ -88,6 +89,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe @@ -88,6 +89,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
88 rsp.Self = append(rsp.Self, *selfRank) 89 rsp.Self = append(rsp.Self, *selfRank)
89 } 90 }
90 if len(ranks) > 0 { 91 if len(ranks) > 0 {
  92 + currentTotal = len(ranks)
91 rsp.Lists = append(rsp.Lists, ranks) 93 rsp.Lists = append(rsp.Lists, ranks)
92 } 94 }
93 } 95 }
@@ -100,7 +102,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe @@ -100,7 +102,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
100 102
101 if len(rsp.Lists) > 0 { 103 if len(rsp.Lists) > 0 {
102 lists := make([][]protocol.RankItem, 0) 104 lists := make([][]protocol.RankItem, 0)
103 - for i := 0; i < rsp.Total; i++ { 105 + for i := 0; i < currentTotal; i++ {
104 items := make([]protocol.RankItem, 0) 106 items := make([]protocol.RankItem, 0)
105 for j := 0; j < len(itemKeys); j++ { 107 for j := 0; j < len(itemKeys); j++ {
106 items = append(items, rsp.Lists[j][i]) 108 items = append(items, rsp.Lists[j][i])