diff --git a/web/html/form/inbound.html b/web/html/form/inbound.html index d51ff5d2..5c982b6c 100644 --- a/web/html/form/inbound.html +++ b/web/html/form/inbound.html @@ -73,6 +73,8 @@ :dropdown-class-name="themeSwitcher.currentTheme"> {{ i18n "pages.inbounds.periodicTrafficReset.never" }} + {{ i18n + "pages.inbounds.periodicTrafficReset.hourly" }} {{ i18n "pages.inbounds.periodicTrafficReset.daily" }} {{ i18n @@ -81,8 +83,6 @@ {{ i18n "pages.inbounds.periodicTrafficReset.monthly" }} - {{ i18n - "pages.inbounds.periodicTrafficReset.hourly" }} diff --git a/web/job/periodic_traffic_reset_job.go b/web/job/periodic_traffic_reset_job.go index 6a7fb6f2..48aab2a1 100644 --- a/web/job/periodic_traffic_reset_job.go +++ b/web/job/periodic_traffic_reset_job.go @@ -37,7 +37,7 @@ func (j *PeriodicTrafficResetJob) Run() { resetCount := 0 for _, inbound := range inbounds { - resetInboundErr := j.inboundService.ResetAllTraffics() + resetInboundErr := j.inboundService.ResetInboundTraffic(inbound.Id) if resetInboundErr != nil { logger.Warning("Failed to reset traffic for inbound", inbound.Id, ":", resetInboundErr) } diff --git a/web/service/inbound.go b/web/service/inbound.go index 8a3a4ae2..81f37389 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -1891,6 +1891,16 @@ func (s *InboundService) ResetAllTraffics() error { return err } +func (s *InboundService) ResetInboundTraffic(id int) error { + db := database.GetDB() + + result := db.Model(model.Inbound{}). + Where("id = ?", id). + Updates(map[string]any{"up": 0, "down": 0}) + + return result.Error +} + func (s *InboundService) DelDepletedClients(id int) (err error) { db := database.GetDB() tx := db.Begin() diff --git a/web/translation/translate.ar_EG.toml b/web/translation/translate.ar_EG.toml index 17e547af..c3c5e966 100644 --- a/web/translation/translate.ar_EG.toml +++ b/web/translation/translate.ar_EG.toml @@ -271,7 +271,7 @@ "daily" = "يومياً" "weekly" = "أسبوعياً" "monthly" = "شهرياً" -"hourly" = "hourly" +"hourly" = "كل ساعة" [pages.inbounds.toasts] "obtain" = "تم الحصول عليه" diff --git a/web/translation/translate.es_ES.toml b/web/translation/translate.es_ES.toml index 03ffe566..74052740 100644 --- a/web/translation/translate.es_ES.toml +++ b/web/translation/translate.es_ES.toml @@ -271,7 +271,7 @@ "daily" = "Diariamente" "weekly" = "Semanalmente" "monthly" = "Mensualmente" -"hourly" = "hourly" +"hourly" = "Cada hora" [pages.inbounds.toasts] "obtain" = "Recibir" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index c29a2ac1..61eee590 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -271,7 +271,7 @@ "daily" = "روزانه" "weekly" = "هفتگی" "monthly" = "ماهانه" -"hourly" = "hourly" +"hourly" = "هر ساعت" [pages.inbounds.toasts] "obtain" = "فراهم‌سازی" diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml index d8bdf256..072f37ef 100644 --- a/web/translation/translate.id_ID.toml +++ b/web/translation/translate.id_ID.toml @@ -271,7 +271,7 @@ "daily" = "Harian" "weekly" = "Mingguan" "monthly" = "Bulanan" -"hourly" = "hourly" +"hourly" = "Setiap jam" [pages.inbounds.toasts] "obtain" = "Dapatkan" diff --git a/web/translation/translate.ja_JP.toml b/web/translation/translate.ja_JP.toml index 4a5839df..65b0da42 100644 --- a/web/translation/translate.ja_JP.toml +++ b/web/translation/translate.ja_JP.toml @@ -271,7 +271,7 @@ "daily" = "毎日" "weekly" = "毎週" "monthly" = "毎月" -"hourly" = "hourly" +"hourly" = "毎時" [pages.inbounds.toasts] "obtain" = "取得" diff --git a/web/translation/translate.pt_BR.toml b/web/translation/translate.pt_BR.toml index 160649f0..5d944d91 100644 --- a/web/translation/translate.pt_BR.toml +++ b/web/translation/translate.pt_BR.toml @@ -271,7 +271,7 @@ "daily" = "Diariamente" "weekly" = "Semanalmente" "monthly" = "Mensalmente" -"hourly" = "hourly" +"hourly" = "A cada hora" [pages.inbounds.toasts] "obtain" = "Obter" diff --git a/web/translation/translate.tr_TR.toml b/web/translation/translate.tr_TR.toml index 15033c3c..73b6792b 100644 --- a/web/translation/translate.tr_TR.toml +++ b/web/translation/translate.tr_TR.toml @@ -271,7 +271,7 @@ "daily" = "Günlük" "weekly" = "Haftalık" "monthly" = "Aylık" -"hourly" = "hourly" +"hourly" = "Saatlik" [pages.inbounds.toasts] "obtain" = "Elde Et" diff --git a/web/translation/translate.uk_UA.toml b/web/translation/translate.uk_UA.toml index ea44c1cd..58284526 100644 --- a/web/translation/translate.uk_UA.toml +++ b/web/translation/translate.uk_UA.toml @@ -271,7 +271,7 @@ "daily" = "Щодня" "weekly" = "Щотижня" "monthly" = "Щомісяця" -"hourly" = "hourly" +"hourly" = "Щогодини" [pages.inbounds.toasts] "obtain" = "Отримати" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index 3d72c62d..da46c37c 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -271,7 +271,7 @@ "daily" = "Hàng ngày" "weekly" = "Hàng tuần" "monthly" = "Hàng tháng" -"hourly" = "hourly" +"hourly" = "Hàng giờ" [pages.inbounds.toasts] "obtain" = "Nhận" diff --git a/web/translation/translate.zh_CN.toml b/web/translation/translate.zh_CN.toml index 6c2c30b1..520ee266 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -271,7 +271,7 @@ "daily" = "每日" "weekly" = "每周" "monthly" = "每月" -"hourly" = "hourly" +"hourly" = "每小时" [pages.inbounds.toasts] "obtain" = "获取" diff --git a/web/translation/translate.zh_TW.toml b/web/translation/translate.zh_TW.toml index 950268d0..d8a529c5 100644 --- a/web/translation/translate.zh_TW.toml +++ b/web/translation/translate.zh_TW.toml @@ -271,7 +271,7 @@ "daily" = "每日" "weekly" = "每週" "monthly" = "每月" -"hourly" = "hourly" +"hourly" = "每小時" [pages.inbounds.toasts] "obtain" = "獲取"