fix: полный продакшен-фикс dashboard/peer/hysteria по fix35
This commit is contained in:
@@ -44,19 +44,33 @@ func DashboardSummary() (vo.DashboardSummaryVo, error) {
|
||||
func DashboardTimeseries(rangeKey string) (vo.DashboardTimeseriesVo, error) {
|
||||
nowMs := time.Now().UnixMilli()
|
||||
fromMs := nowMs - int64(24*time.Hour/time.Millisecond)
|
||||
bucketMs := int64(5 * time.Minute / time.Millisecond)
|
||||
source := "sample"
|
||||
r := strings.TrimSpace(rangeKey)
|
||||
if r == "1h" {
|
||||
fromMs = nowMs - int64(time.Hour/time.Millisecond)
|
||||
bucketMs = int64(time.Minute / time.Millisecond)
|
||||
source = "sample"
|
||||
} else if r == "7d" {
|
||||
fromMs = nowMs - int64(7*24*time.Hour/time.Millisecond)
|
||||
bucketMs = int64(time.Hour / time.Millisecond)
|
||||
source = "hourly"
|
||||
} else if r == "30d" {
|
||||
fromMs = nowMs - int64(30*24*time.Hour/time.Millisecond)
|
||||
bucketMs = int64(24 * time.Hour / time.Millisecond)
|
||||
source = "daily"
|
||||
r = "30d"
|
||||
} else if r == "" {
|
||||
r = "24h"
|
||||
bucketMs = int64(5 * time.Minute / time.Millisecond)
|
||||
source = "sample"
|
||||
} else {
|
||||
r = "24h"
|
||||
bucketMs = int64(5 * time.Minute / time.Millisecond)
|
||||
source = "sample"
|
||||
}
|
||||
|
||||
traffic, err := dao.DashboardTrafficTimeseries(fromMs, nowMs)
|
||||
traffic, err := dao.DashboardTrafficTimeseries(fromMs, nowMs, bucketMs, source)
|
||||
if err != nil {
|
||||
return vo.DashboardTimeseriesVo{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user