From ce11fe397fba937aca475c144f436852f3034e8f Mon Sep 17 00:00:00 2001 From: Azavax <21226881+azavaxhuman@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:51:14 +0330 Subject: [PATCH] Update inbound.go --- web/service/inbound.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/service/inbound.go b/web/service/inbound.go index f2646dbb..66e1a420 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -1785,6 +1785,21 @@ func (s *InboundService) GetClientTrafficByEmail(email string) (traffic *xray.Cl return nil, nil } +func (s *InboundService) UpdateClientTrafficByEmail(email string, upload int64, download int64) error { + db := database.GetDB() + + result := db.Model(xray.ClientTraffic{}). + Where("email = ?", email). + Updates(map[string]any{"up": upload, "down": download}) + + err := result.Error + if err != nil { + logger.Warningf("Error updating ClientTraffic with email %s: %v", email, err) + return err + } + return nil +} + func (s *InboundService) GetClientTrafficByID(id string) ([]xray.ClientTraffic, error) { db := database.GetDB() var traffics []xray.ClientTraffic