feat: 统计页支持一年时段和按日趋势
在线人数在新的有效访问后尽快刷新,历史查询保留一年并画出每日连接数。
This commit is contained in:
@@ -38,8 +38,8 @@ func TestParseRange(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("too long", func(t *testing.T) {
|
||||
_, _, err := parseRange(now.Add(-73*time.Hour).Format(time.RFC3339), now.Format(time.RFC3339), now)
|
||||
if err == nil || err.Code != "range_too_long" || err.Message != "时段不能超过 72 小时" {
|
||||
_, _, err := parseRange(now.Add(-retainDuration-time.Hour).Format(time.RFC3339), now.Format(time.RFC3339), now)
|
||||
if err == nil || err.Code != "range_too_long" || err.Message != "时段不能超过 1 年" {
|
||||
t.Fatalf("%+v", err)
|
||||
}
|
||||
})
|
||||
@@ -127,7 +127,7 @@ func TestRangeHTTP(t *testing.T) {
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
q.Set("start", now.Add(-73*time.Hour).Format(time.RFC3339))
|
||||
q.Set("start", now.Add(-retainDuration-time.Hour).Format(time.RFC3339))
|
||||
q.Set("end", now.Format(time.RFC3339))
|
||||
rr = call(q.Encode())
|
||||
if rr.Code != 400 || decodeErr(rr).Error != "range_too_long" {
|
||||
|
||||
Reference in New Issue
Block a user