...
|
...
|
@@ -440,31 +440,51 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut |
|
|
"companyId": contributionsWealthRankingQuery.CompanyId,
|
|
|
}
|
|
|
|
|
|
if _, listIntervals, err := listIntervalRepository.Find(listListIntervalQuery); err != nil {
|
|
|
if _, listIntervals, err := listIntervalRepository.FindAll(listListIntervalQuery); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if len(listIntervals) == 0 { // 未配置年榜
|
|
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
} else if len(listIntervals) == 1 { // 只配置了一个年榜
|
|
|
currentTime := time.Now().Local()
|
|
|
if currentTime.After(listIntervals[0].IntervalStartTime.Local()) && currentTime.Before(listIntervals[0].IntervalEndTime.Local()) || currentTime.Equal(listIntervals[0].IntervalStartTime.Local()) || currentTime.Equal(listIntervals[0].IntervalEndTime.Local()) { // 当前时间在榜单内
|
|
|
//currentTime := time.Now().Local()
|
|
|
//if currentTime.After(listIntervals[0].IntervalStartTime.Local()) && currentTime.Before(listIntervals[0].IntervalEndTime.Local()) || currentTime.Equal(listIntervals[0].IntervalStartTime.Local()) || currentTime.Equal(listIntervals[0].IntervalEndTime.Local()) { // 当前时间在榜单内
|
|
|
// contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime.Local()
|
|
|
// contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime.Local()
|
|
|
//} else { // 当前时间处于空档期
|
|
|
// contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
// contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
|
|
//}
|
|
|
currentTime := time.Now().Local().Unix()
|
|
|
if currentTime >= listIntervals[0].IntervalStartTime.Unix() && currentTime <= listIntervals[0].IntervalEndTime.Local().Unix() {
|
|
|
contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime.Local()
|
|
|
contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime.Local()
|
|
|
} else { // 当前时间处于空档期
|
|
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
}
|
|
|
} else { // 配置了多个年榜,判断当前时间是否在榜单里
|
|
|
currentTime := time.Now().Local()
|
|
|
//currentTime := time.Now().Local()
|
|
|
//for _, listInterval := range listIntervals {
|
|
|
// if currentTime.After(listInterval.IntervalStartTime.Local()) && currentTime.Before(listInterval.IntervalEndTime.Local()) || currentTime.Equal(listInterval.IntervalStartTime.Local()) || currentTime.Equal(listInterval.IntervalEndTime.Local()) { // 当前时间在榜单内
|
|
|
// contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime.Local()
|
|
|
// contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime.Local()
|
|
|
// break
|
|
|
// } else { // 当前时间处于空档期
|
|
|
// contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
// contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
|
|
// break
|
|
|
// }
|
|
|
//}
|
|
|
currentTime := time.Now().Local().Unix()
|
|
|
for _, listInterval := range listIntervals {
|
|
|
if currentTime.After(listInterval.IntervalStartTime.Local()) && currentTime.Before(listInterval.IntervalEndTime.Local()) || currentTime.Equal(listInterval.IntervalStartTime.Local()) || currentTime.Equal(listInterval.IntervalEndTime.Local()) { // 当前时间在榜单内
|
|
|
if currentTime >= listInterval.IntervalStartTime.Local().Unix() && currentTime <= listInterval.IntervalEndTime.Local().Unix() {
|
|
|
contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime.Local()
|
|
|
contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime.Local()
|
|
|
break
|
|
|
} else { // 当前时间处于空档期
|
|
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
break
|
|
|
}
|
|
|
}
|
...
|
...
|
|