增加多个服务流量、带宽统计API

This commit is contained in:
刘祥超
2022-10-03 19:28:03 +08:00
parent f7dd9e3f39
commit 1db4661c75
16 changed files with 779 additions and 40 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/iwind/TeaGo/logs"
timeutil "github.com/iwind/TeaGo/utils/time"
"testing"
"time"
)
func TestServerDailyStatDAO_SaveStats(t *testing.T) {
@@ -83,3 +84,14 @@ func TestServerDailyStatDAO_FindDistinctPlanServerIdsBetweenDay(t *testing.T) {
}
t.Log(serverIds)
}
func TestServerDailyStatDAO_FindStatsBetweenDays(t *testing.T) {
var tx *dbs.Tx
stats, err := NewServerDailyStatDAO().FindStatsBetweenDays(tx, 1, 0, timeutil.Format("Ymd", time.Now().AddDate(0, 0, -1)), timeutil.Format("Ymd"))
if err != nil {
t.Fatal(err)
}
for _, stat := range stats {
t.Log(stat.Day, stat.TimeFrom, stat.TimeTo, stat.Bytes)
}
}