Compare commits

..

2 commits

Author SHA1 Message Date
javadtgh
bee4c75a5a
Merge 5e953bae45 into 299572a4c2 2025-09-17 08:45:25 +05:00
mhsanaei
299572a4c2
API: subid to getClientTraffics
Some checks are pending
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run
/getClientTraffics/:email
/getClientTrafficsById/:id
2025-09-17 01:29:22 +02:00
2 changed files with 3 additions and 1 deletions

View file

@ -1970,8 +1970,8 @@ func (s *InboundService) GetClientTrafficByEmail(email string) (traffic *xray.Cl
return nil, err
}
if t != nil && client != nil {
// Ensure enable mirrors the client's current enable flag in settings
t.Enable = client.Enable
t.SubId = client.SubID
return t, nil
}
return nil, nil
@ -2012,6 +2012,7 @@ func (s *InboundService) GetClientTrafficByID(id string) ([]xray.ClientTraffic,
for i := range traffics {
if ct, client, e := s.GetClientByEmail(traffics[i].Email); e == nil && ct != nil && client != nil {
traffics[i].Enable = client.Enable
traffics[i].SubId = client.SubID
}
}
return traffics, err

View file

@ -5,6 +5,7 @@ type ClientTraffic struct {
InboundId int `json:"inboundId" form:"inboundId"`
Enable bool `json:"enable" form:"enable"`
Email string `json:"email" form:"email" gorm:"unique"`
SubId string `json:"subId" form:"subId" gorm:"-"`
Up int64 `json:"up" form:"up"`
Down int64 `json:"down" form:"down"`
AllTime int64 `json:"allTime" form:"allTime"`