作者 yangfu

修改

@@ -3,7 +3,7 @@ package contrab @@ -3,7 +3,7 @@ package contrab
3 import "github.com/astaxie/beego/toolbox" 3 import "github.com/astaxie/beego/toolbox"
4 4
5 var ( 5 var (
6 - taskComputeRankScore = "0 10 0 * * *" //每0:5分 计算排行榜分数 6 + taskComputeRankScore = "0 */10 * * * *" //每0:5分 计算排行榜分数
7 ) 7 )
8 8
9 func Run() { 9 func Run() {
@@ -43,9 +43,6 @@ func Departments(header *protocol.RequestHeader, request *protocol.DepartmentsRe @@ -43,9 +43,6 @@ func Departments(header *protocol.RequestHeader, request *protocol.DepartmentsRe
43 } 43 }
44 rsp.Departments = tmpDepartment.Departments 44 rsp.Departments = tmpDepartment.Departments
45 rsp.Departments = rsp.GetRootDepartment() 45 rsp.Departments = rsp.GetRootDepartment()
46 - //for i := range rsp.Departments {  
47 - // rsp.Departments[i].Departments = make([]*protocol.Department, 0)  
48 - //}  
49 default: 46 default:
50 break 47 break
51 } 48 }
@@ -101,7 +98,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat @@ -101,7 +98,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
101 } 98 }
102 switch request.Type { 99 switch request.Type {
103 case protocol.StatisticApproved: 100 case protocol.StatisticApproved:
104 - iterateDepartments(func(d *protocol.Department) *protocol.DepartmentStatistics { 101 + callBack := func(d *protocol.Department) *protocol.DepartmentStatistics {
105 item := &protocol.DepartmentStatistics{} 102 item := &protocol.DepartmentStatistics{}
106 dIds := departmentsResponse.GetChildDepartmentIds(d, true) 103 dIds := departmentsResponse.GetChildDepartmentIds(d, true)
107 item.AchievementTotal, _ = agg.AchievementDepartmentStatic(header, 0, dIds) 104 item.AchievementTotal, _ = agg.AchievementDepartmentStatic(header, 0, dIds)
@@ -109,7 +106,8 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat @@ -109,7 +106,8 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
109 item.ACTotal = item.AchievementTotal + item.ChanceApprovedTotal 106 item.ACTotal = item.AchievementTotal + item.ChanceApprovedTotal
110 item.ChanceApprovingTotal, _ = agg.ChanceApprovingStatistic(header, departmentsResponse.GetChildDepartmentIds(d, true)) 107 item.ChanceApprovingTotal, _ = agg.ChanceApprovingStatistic(header, departmentsResponse.GetChildDepartmentIds(d, true))
111 return item 108 return item
112 - }) 109 + }
  110 + iterateDepartments(callBack)
113 break 111 break
114 //case protocol.StatisticApproving: 112 //case protocol.StatisticApproving:
115 // iterateDepartments(func(d *protocol.Department) *protocol.DepartmentStatistics { 113 // iterateDepartments(func(d *protocol.Department) *protocol.DepartmentStatistics {