Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'web/service/inbound.go')
-rw-r--r--web/service/inbound.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index f857bfaa..b7eb6789 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -507,6 +507,17 @@ func (s *InboundService) DisableInvalidInbounds() (int64, error) {
count := result.RowsAffected
return count, err
}
+func (s *InboundService) RemoveOrphanedTraffics() {
+ db := database.GetDB()
+ db.Exec(`
+ DELETE FROM client_traffics
+ WHERE email NOT IN (
+ SELECT JSON_EXTRACT(client.value, '$.email')
+ FROM inbounds,
+ JSON_EACH(JSON_EXTRACT(inbounds.settings, '$.clients')) AS client
+ )
+ `)
+}
func (s *InboundService) DisableInvalidClients() (int64, error) {
db := database.GetDB()
now := time.Now().Unix() * 1000