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:
authorMHSanaei <ho3ein.sanaei@gmail.com>2023-03-17 01:01:14 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2023-03-17 01:01:14 +0300
commitbc56e637376142c370c31b17558fc3778a863bd2 (patch)
treec79da826c4dc58ca6b024a419959ed3475599a10 /web/service/inbound.go
parenta3e562896178fadc3df5a921669e75824180ccf8 (diff)
pack1
Diffstat (limited to 'web/service/inbound.go')
-rw-r--r--web/service/inbound.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index 450c77f0..b3f3265b 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -275,15 +275,18 @@ func (s *InboundService) AddClientTraffic(traffics []*xray.ClientTraffic) (err e
for _, traffic := range traffics {
inbound := &model.Inbound{}
-
- err := txInbound.Where("settings like ?", "%"+traffic.Email+"%").First(inbound).Error
- traffic.InboundId = inbound.Id
+ client := &xray.ClientTraffic{}
+ err := tx.Where("email = ?", traffic.Email).First(client).Error
if err != nil {
if err == gorm.ErrRecordNotFound {
- // delete removed client record
- clientErr := s.DelClientStat(tx, traffic.Email)
- logger.Warning(err, traffic.Email, clientErr)
-
+ logger.Warning(err, traffic.Email)
+ }
+ continue
+ }
+ err = txInbound.Where("id=?", client.InboundId).First(inbound).Error
+ if err != nil {
+ if err == gorm.ErrRecordNotFound {
+ logger.Warning(err, traffic.Email)
}
continue
}