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:
authorMasoud Hidden <masoud.hidden.user@gmail.com>2023-05-05 00:46:43 +0300
committerMasoud Hidden <masoud.hidden.user@gmail.com>2023-05-05 00:46:43 +0300
commit961636b5106b0503051e2e6e63bc613397f170e3 (patch)
tree924fd3cf148c39852401bf1ce656067199ebb9a1 /web/service/inbound.go
parent88b7d0dc44eed9b2e1224297d9ac1e0d28639a28 (diff)
Client reset buttons for telegram bot
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()