fix: полный продакшен-фикс dashboard/peer/hysteria по fix35

This commit is contained in:
2026-05-09 15:38:30 +05:00
parent a4157d1363
commit 78656e74b0
18 changed files with 190 additions and 85 deletions
+15 -1
View File
@@ -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
}