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:
authorHamidreza <70919649+hamid-gh98@users.noreply.github.com>2023-07-01 15:26:43 +0300
committerGitHub <noreply@github.com>2023-07-01 15:26:43 +0300
commit10283193862e7bd36b20e6b2c41411d251961c27 (patch)
tree892d133611c08e01db4b372645d8bcf579635739 /web/service
parentf726474a5db3fa68eeb78729a58629382f6d2699 (diff)
🚀 Some improvements for x-ui.sh and ip job (#665)
Diffstat (limited to 'web/service')
-rw-r--r--web/service/inbound.go12
-rw-r--r--web/service/server.go4
2 files changed, 5 insertions, 11 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index 802e753d..b278eb57 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -5,6 +5,7 @@ import (
"fmt"
"strings"
"time"
+
"x-ui/database"
"x-ui/database/model"
"x-ui/logger"
@@ -74,7 +75,6 @@ func (s *InboundService) getAllEmails() ([]string, error) {
FROM inbounds,
JSON_EACH(JSON_EXTRACT(inbounds.settings, '$.clients')) AS client
`).Scan(&emails).Error
-
if err != nil {
return nil, err
}
@@ -816,7 +816,8 @@ func (s *InboundService) UpdateClientStat(email string, client *model.Client) er
"enable": true,
"email": client.Email,
"total": client.TotalGB,
- "expiry_time": client.ExpiryTime})
+ "expiry_time": client.ExpiryTime,
+ })
err := result.Error
if err != nil {
return err
@@ -1068,8 +1069,8 @@ func (s *InboundService) ResetClientIpLimitByEmail(clientEmail string, count int
return err
}
return nil
-
}
+
func (s *InboundService) ResetClientExpiryTimeByEmail(clientEmail string, expiry_time int64) error {
_, inbound, err := s.GetClientInboundByEmail(clientEmail)
if err != nil {
@@ -1126,7 +1127,6 @@ func (s *InboundService) ResetClientExpiryTimeByEmail(clientEmail string, expiry
return err
}
return nil
-
}
func (s *InboundService) ResetClientTrafficByEmail(clientEmail string) error {
@@ -1137,7 +1137,6 @@ func (s *InboundService) ResetClientTrafficByEmail(clientEmail string) error {
Updates(map[string]interface{}{"enable": true, "up": 0, "down": 0})
err := result.Error
-
if err != nil {
return err
}
@@ -1209,7 +1208,6 @@ func (s *InboundService) ResetAllClientTraffics(id int) error {
Updates(map[string]interface{}{"enable": true, "up": 0, "down": 0})
err := result.Error
-
if err != nil {
return err
}
@@ -1224,7 +1222,6 @@ func (s *InboundService) ResetAllTraffics() error {
Updates(map[string]interface{}{"up": 0, "down": 0})
err := result.Error
-
if err != nil {
return err
}
@@ -1411,7 +1408,6 @@ func (s *InboundService) ClearClientIps(clientEmail string) error {
Where("client_email = ?", clientEmail).
Update("ips", "")
err := result.Error
-
if err != nil {
return err
}
diff --git a/web/service/server.go b/web/service/server.go
index 936e6469..5216be5a 100644
--- a/web/service/server.go
+++ b/web/service/server.go
@@ -14,6 +14,7 @@ import (
"runtime"
"strings"
"time"
+
"x-ui/config"
"x-ui/database"
"x-ui/logger"
@@ -250,7 +251,6 @@ func (s *ServerService) GetXrayVersions() ([]string, error) {
}
func (s *ServerService) StopXrayService() (string error) {
-
err := s.xrayService.StopXray()
if err != nil {
logger.Error("stop xray failed:", err)
@@ -261,7 +261,6 @@ func (s *ServerService) StopXrayService() (string error) {
}
func (s *ServerService) RestartXrayService() (string error) {
-
s.xrayService.StopXray()
defer func() {
err := s.xrayService.RestartXray(true)
@@ -377,7 +376,6 @@ func (s *ServerService) UpdateXray(version string) error {
}
return nil
-
}
func (s *ServerService) GetLogs(count string, logLevel string) ([]string, error) {