|
@@ -440,31 +440,51 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut |
|
@@ -440,31 +440,51 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut |
440
|
"companyId": contributionsWealthRankingQuery.CompanyId,
|
440
|
"companyId": contributionsWealthRankingQuery.CompanyId,
|
441
|
}
|
441
|
}
|
442
|
|
442
|
|
443
|
- if _, listIntervals, err := listIntervalRepository.Find(listListIntervalQuery); err != nil {
|
443
|
+ if _, listIntervals, err := listIntervalRepository.FindAll(listListIntervalQuery); err != nil {
|
444
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
444
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
445
|
} else {
|
445
|
} else {
|
446
|
if len(listIntervals) == 0 { // 未配置年榜
|
446
|
if len(listIntervals) == 0 { // 未配置年榜
|
447
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
447
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
448
|
- contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
448
|
+ contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
449
|
} else if len(listIntervals) == 1 { // 只配置了一个年榜
|
449
|
} else if len(listIntervals) == 1 { // 只配置了一个年榜
|
450
|
- currentTime := time.Now().Local()
|
|
|
451
|
- 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()) { // 当前时间在榜单内
|
450
|
+ //currentTime := time.Now().Local()
|
|
|
451
|
+ //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()) { // 当前时间在榜单内
|
|
|
452
|
+ // contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime.Local()
|
|
|
453
|
+ // contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime.Local()
|
|
|
454
|
+ //} else { // 当前时间处于空档期
|
|
|
455
|
+ // contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
456
|
+ // contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
|
|
457
|
+ //}
|
|
|
458
|
+ currentTime := time.Now().Local().Unix()
|
|
|
459
|
+ if currentTime >= listIntervals[0].IntervalStartTime.Unix() && currentTime <= listIntervals[0].IntervalEndTime.Local().Unix() {
|
452
|
contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime.Local()
|
460
|
contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime.Local()
|
453
|
contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime.Local()
|
461
|
contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime.Local()
|
454
|
} else { // 当前时间处于空档期
|
462
|
} else { // 当前时间处于空档期
|
455
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
463
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
456
|
- contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
464
|
+ contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
457
|
}
|
465
|
}
|
458
|
} else { // 配置了多个年榜,判断当前时间是否在榜单里
|
466
|
} else { // 配置了多个年榜,判断当前时间是否在榜单里
|
459
|
- currentTime := time.Now().Local()
|
467
|
+ //currentTime := time.Now().Local()
|
|
|
468
|
+ //for _, listInterval := range listIntervals {
|
|
|
469
|
+ // if currentTime.After(listInterval.IntervalStartTime.Local()) && currentTime.Before(listInterval.IntervalEndTime.Local()) || currentTime.Equal(listInterval.IntervalStartTime.Local()) || currentTime.Equal(listInterval.IntervalEndTime.Local()) { // 当前时间在榜单内
|
|
|
470
|
+ // contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime.Local()
|
|
|
471
|
+ // contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime.Local()
|
|
|
472
|
+ // break
|
|
|
473
|
+ // } else { // 当前时间处于空档期
|
|
|
474
|
+ // contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
|
|
475
|
+ // contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
|
|
476
|
+ // break
|
|
|
477
|
+ // }
|
|
|
478
|
+ //}
|
|
|
479
|
+ currentTime := time.Now().Local().Unix()
|
460
|
for _, listInterval := range listIntervals {
|
480
|
for _, listInterval := range listIntervals {
|
461
|
- if currentTime.After(listInterval.IntervalStartTime.Local()) && currentTime.Before(listInterval.IntervalEndTime.Local()) || currentTime.Equal(listInterval.IntervalStartTime.Local()) || currentTime.Equal(listInterval.IntervalEndTime.Local()) { // 当前时间在榜单内
|
481
|
+ if currentTime >= listInterval.IntervalStartTime.Local().Unix() && currentTime <= listInterval.IntervalEndTime.Local().Unix() {
|
462
|
contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime.Local()
|
482
|
contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime.Local()
|
463
|
contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime.Local()
|
483
|
contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime.Local()
|
464
|
break
|
484
|
break
|
465
|
} else { // 当前时间处于空档期
|
485
|
} else { // 当前时间处于空档期
|
466
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
486
|
contributionsWealthRankingQuery.StartTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
467
|
- contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 23, 59, 59, 0, time.Local)
|
487
|
+ contributionsWealthRankingQuery.EndTime = time.Date(0001, 01, 02, 0, 0, 0, 0, time.Local)
|
468
|
break
|
488
|
break
|
469
|
}
|
489
|
}
|
470
|
}
|
490
|
}
|