...
|
...
|
@@ -433,28 +433,29 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if len(listIntervals) == 0 { // 未配置年榜
|
|
|
contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
timeNow := time.Now().Local()
|
|
|
contributionsWealthRankingQuery.StartTime = time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, time.Local)
|
|
|
} else if len(listIntervals) == 1 { // 只配置了一个年榜
|
|
|
currentTime := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
if currentTime.Before(listIntervals[0].IntervalStartTime) && currentTime.After(listIntervals[0].IntervalEndTime) || currentTime.Equal(listIntervals[0].IntervalStartTime) || currentTime.Equal(listIntervals[0].IntervalEndTime) { // 当前时间在榜单内
|
|
|
contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime
|
|
|
contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime
|
|
|
currentTime := time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local)
|
|
|
if currentTime.Before(listIntervals[0].IntervalStartTime.Local()) && currentTime.After(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(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local)
|
|
|
}
|
|
|
} else { // 配置了多个年榜
|
|
|
// 判断当前时间是否在榜单里
|
|
|
currentTime := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
currentTime := time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local)
|
|
|
for _, listInterval := range listIntervals {
|
|
|
if currentTime.Before(listInterval.IntervalStartTime) && currentTime.After(listInterval.IntervalEndTime) || currentTime.Equal(listInterval.IntervalStartTime) || currentTime.Equal(listInterval.IntervalEndTime) { // 当前时间在榜单内
|
|
|
contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime
|
|
|
contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime
|
|
|
if currentTime.Before(listInterval.IntervalStartTime.Local()) && currentTime.After(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(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
|
|
|
contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local)
|
|
|
contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local)
|
|
|
break
|
|
|
}
|
|
|
}
|
...
|
...
|
|