mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
✨ 展示月流量使用情况
This commit is contained in:
@@ -42,7 +42,7 @@ func percentage(used, total uint64) float64 {
|
||||
}
|
||||
|
||||
// Snapshot 未通过规则返回 struct{}{}, 通过返回 nil
|
||||
func (u *Rule) Snapshot(server *Server, db *gorm.DB) interface{} {
|
||||
func (u *Rule) Snapshot(cycleTransferStats *CycleTransferStats, server *Server, db *gorm.DB) interface{} {
|
||||
// 监控全部但是排除了此服务器
|
||||
if u.Cover == RuleCoverAll && u.Ignore[server.ID] {
|
||||
return nil
|
||||
@@ -139,6 +139,11 @@ func (u *Rule) Snapshot(server *Server, db *gorm.DB) interface{} {
|
||||
} else {
|
||||
u.LastCycleStatus[server.ID] = nil
|
||||
}
|
||||
if cycleTransferStats.ServerName[server.ID] != server.Name {
|
||||
cycleTransferStats.ServerName[server.ID] = server.Name
|
||||
}
|
||||
cycleTransferStats.Transfer[server.ID] = uint64(src)
|
||||
cycleTransferStats.NextUpdate[server.ID] = u.NextTransferAt[server.ID]
|
||||
}
|
||||
|
||||
if u.Type == "offline" && float64(time.Now().Unix())-src > 6 {
|
||||
|
||||
Reference in New Issue
Block a user