mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 12:20:28 +08:00
数据看板增加独立IP数量
This commit is contained in:
@@ -92,13 +92,16 @@ func (this *IndexAction) RunPost(params struct{}) {
|
||||
"diskUsageWarning": diskUsageWarning,
|
||||
}
|
||||
|
||||
// 今日流量
|
||||
todayTrafficBytes := int64(0)
|
||||
// 今日流量和独立IP数
|
||||
var todayTrafficBytes int64
|
||||
var todayCountIPs int64
|
||||
if len(resp.DailyTrafficStats) > 0 {
|
||||
todayTrafficBytes = resp.DailyTrafficStats[len(resp.DailyTrafficStats)-1].Bytes
|
||||
var lastDailyTrafficStat = resp.DailyTrafficStats[len(resp.DailyTrafficStats)-1]
|
||||
todayTrafficBytes = lastDailyTrafficStat.Bytes
|
||||
todayCountIPs = lastDailyTrafficStat.CountIPs
|
||||
}
|
||||
todayTrafficString := numberutils.FormatBytes(todayTrafficBytes)
|
||||
result := regexp.MustCompile(`^(?U)(.+)([a-zA-Z]+)$`).FindStringSubmatch(todayTrafficString)
|
||||
var todayTrafficString = numberutils.FormatBytes(todayTrafficBytes)
|
||||
var result = regexp.MustCompile(`^(?U)(.+)([a-zA-Z]+)$`).FindStringSubmatch(todayTrafficString)
|
||||
if len(result) > 2 {
|
||||
this.Data["todayTraffic"] = result[1]
|
||||
this.Data["todayTrafficUnit"] = result[2]
|
||||
@@ -107,6 +110,8 @@ func (this *IndexAction) RunPost(params struct{}) {
|
||||
this.Data["todayTrafficUnit"] = ""
|
||||
}
|
||||
|
||||
this.Data["todayCountIPs"] = todayCountIPs
|
||||
|
||||
// 24小时流量趋势
|
||||
{
|
||||
statMaps := []maps.Map{}
|
||||
@@ -137,6 +142,7 @@ func (this *IndexAction) RunPost(params struct{}) {
|
||||
"countAttackRequests": stat.CountAttackRequests,
|
||||
"attackBytes": stat.AttackBytes,
|
||||
"day": stat.Day[4:6] + "月" + stat.Day[6:] + "日",
|
||||
"countIPs": stat.CountIPs,
|
||||
})
|
||||
}
|
||||
this.Data["dailyTrafficStats"] = statMaps
|
||||
|
||||
Reference in New Issue
Block a user