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:
Diffstat (limited to 'web/service/inbound.go')
-rw-r--r--web/service/inbound.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index c496086a..95c3d745 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -664,6 +664,36 @@ func (s *InboundService) DelClientIPs(tx *gorm.DB, email string) error {
return tx.Where("client_email = ?", email).Delete(model.InboundClientIps{}).Error
}
+func (s *InboundService) ResetClientExpiryTimeByEmail(clientEmail string, expiry_time int64) error {
+ db := database.GetDB()
+
+ result := db.Model(xray.ClientTraffic{}).
+ Where("email = ?", clientEmail).
+ Updates(map[string]interface{}{"enable": true, "expiry_time": expiry_time})
+
+ err := result.Error
+
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+func (s *InboundService) ResetClientTrafficByEmail(clientEmail string) error {
+ db := database.GetDB()
+
+ result := db.Model(xray.ClientTraffic{}).
+ Where("email = ?", clientEmail).
+ Updates(map[string]interface{}{"enable": true, "up": 0, "down": 0})
+
+ err := result.Error
+
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
func (s *InboundService) ResetClientTraffic(id int, clientEmail string) error {
db := database.GetDB()