feat: add UUID to ClientTraffic (#3491)

* Update client_traffic.go

* Update inbound.go
This commit is contained in:
RahGozar 2025-09-17 19:15:28 +03:30 committed by GitHub
parent 0a58b5e745
commit fcdeb1fc79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View file

@ -1953,6 +1953,7 @@ func (s *InboundService) GetClientTrafficByEmail(email string) (traffic *xray.Cl
if t != nil && client != nil {
t.Enable = client.Enable
t.SubId = client.SubID
t.UUID = client.ID
return t, nil
}
return nil, nil
@ -1994,6 +1995,7 @@ func (s *InboundService) GetClientTrafficByID(id string) ([]xray.ClientTraffic,
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
traffics[i].UUID = client.ID
}
}
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"`
UUID string `json:"uuid" form:"uuid" gorm:"unique;type:char(36)"`
SubId string `json:"subId" form:"subId" gorm:"-"`
Up int64 `json:"up" form:"up"`
Down int64 `json:"down" form:"down"`