diff options
| author | Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com> | 2023-05-12 17:59:02 +0300 |
|---|---|---|
| committer | Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com> | 2023-05-12 21:15:24 +0300 |
| commit | d39c7e4ae37a3c78f1f0e08f9a52fde5ce08ea1d (patch) | |
| tree | d60402eb56840813d04e8e175b6ca96c68fa0216 /web | |
| parent | 3bec9ee2737d0a8c49f4d705f1d8c8925bb8a2a8 (diff) | |
only get enabled inbounds and clients
Diffstat (limited to 'web')
| -rw-r--r-- | web/service/sub.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/web/service/sub.go b/web/service/sub.go index 9a86c3eb..bc34366f 100644 --- a/web/service/sub.go +++ b/web/service/sub.go @@ -38,7 +38,7 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, string, error continue } for _, client := range clients { - if client.SubID == subId { + if client.Enable && client.SubID == subId { link := s.getLink(inbound, client.Email) result = append(result, link) clientTraffics = append(clientTraffics, s.getClientTraffics(inbound.ClientStats, client.Email)) @@ -73,7 +73,7 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, string, error func (s *SubService) getInboundsBySubId(subId string) ([]*model.Inbound, error) { db := database.GetDB() var inbounds []*model.Inbound - err := db.Model(model.Inbound{}).Preload("ClientStats").Where("settings like ?", fmt.Sprintf(`%%"subId": "%s"%%`, subId)).Find(&inbounds).Error + err := db.Model(model.Inbound{}).Preload("ClientStats").Where("settings like ? and enable = ?", fmt.Sprintf(`%%"subId": "%s"%%`, subId), true).Find(&inbounds).Error if err != nil && err != gorm.ErrRecordNotFound { return nil, err } |
