mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 23:20:26 +08:00
网站看板数据中增加当日独立IP和当日流量
This commit is contained in:
@@ -66,7 +66,7 @@ func init() {
|
||||
// 更新网站的带宽峰值
|
||||
if stat.ServerId > 0 {
|
||||
// 更新带宽统计
|
||||
err = models.SharedServerBandwidthStatDAO.UpdateServerBandwidth(tx, stat.UserId, stat.ServerId, stat.NodeRegionId, stat.UserPlanId, stat.Day, stat.TimeAt, stat.Bytes, stat.TotalBytes, stat.CachedBytes, stat.AttackBytes, stat.CountRequests, stat.CountCachedRequests, stat.CountAttackRequests)
|
||||
err = models.SharedServerBandwidthStatDAO.UpdateServerBandwidth(tx, stat.UserId, stat.ServerId, stat.NodeRegionId, stat.UserPlanId, stat.Day, stat.TimeAt, stat.Bytes, stat.TotalBytes, stat.CachedBytes, stat.AttackBytes, stat.CountRequests, stat.CountCachedRequests, stat.CountAttackRequests, stat.CountIPs)
|
||||
if err != nil {
|
||||
remotelogs.Error("ServerBandwidthStatService", "dump bandwidth stats failed: "+err.Error())
|
||||
}
|
||||
@@ -147,6 +147,7 @@ func (this *ServerBandwidthStatService) UploadServerBandwidthStats(ctx context.C
|
||||
oldStat.CountCachedRequests += stat.CountCachedRequests
|
||||
oldStat.CountAttackRequests += stat.CountAttackRequests
|
||||
oldStat.CountWebsocketConnections += stat.CountWebsocketConnections
|
||||
oldStat.CountIPs += stat.CountIPs
|
||||
} else {
|
||||
serverBandwidthStatsMap[key] = &pb.ServerBandwidthStat{
|
||||
Id: 0,
|
||||
@@ -164,6 +165,7 @@ func (this *ServerBandwidthStatService) UploadServerBandwidthStats(ctx context.C
|
||||
CountAttackRequests: stat.CountAttackRequests,
|
||||
CountWebsocketConnections: stat.CountWebsocketConnections,
|
||||
UserPlanId: stat.UserPlanId,
|
||||
CountIPs: stat.CountIPs,
|
||||
}
|
||||
}
|
||||
serverBandwidthStatsLocker.Unlock()
|
||||
|
||||
@@ -471,6 +471,17 @@ func (this *ServerStatBoardService) ComposeServerStatBoard(ctx context.Context,
|
||||
}
|
||||
}
|
||||
|
||||
// 当日统计
|
||||
{
|
||||
var day = timeutil.Format("Ymd")
|
||||
stat, err := models.SharedServerBandwidthStatDAO.SumDailyStat(tx, req.ServerId, 0, day, day)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.DailyCountIPs = stat.CountIPs
|
||||
result.DailyTrafficBytes = stat.Bytes
|
||||
}
|
||||
|
||||
// 带宽统计
|
||||
{
|
||||
var month = timeutil.Format("Ym")
|
||||
|
||||
Reference in New Issue
Block a user