...
|
...
|
@@ -11,32 +11,35 @@ import ( |
|
|
//排行榜
|
|
|
func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRequest) (rsp *protocol.GetRankListResponse, err error) {
|
|
|
var (
|
|
|
ranks []protocol.RankItem
|
|
|
selfRank *protocol.RankItem
|
|
|
rankRange *models.RankRange
|
|
|
itemKeys []string
|
|
|
itemNames []string
|
|
|
ranks []protocol.RankItem
|
|
|
selfRank *protocol.RankItem
|
|
|
rankRange *models.RankRange
|
|
|
itemKeys []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)
|
...
|
...
|
|