From 38db94f5070660d307e5193eb95dd30d18e836e7 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Wed, 5 Apr 2023 09:36:23 +0200 Subject: [PATCH] [bug] fix time calculation #143 --- web/assets/js/model/xray.js | 6 +++--- web/html/xui/client_bulk_modal.html | 4 ++-- web/html/xui/client_modal.html | 4 ++-- web/html/xui/inbound_info_modal.html | 2 +- web/html/xui/inbounds.html | 2 +- web/service/tgbot.go | 12 ++++++------ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index a701c88e..d6774703 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -1460,7 +1460,7 @@ Inbound.VmessSettings.Vmess = class extends XrayCommonClass { return null; } if (this.expiryTime < 0){ - return this.expiryTime / -84600000; + return this.expiryTime / -86400000; } return moment(this.expiryTime); } @@ -1551,7 +1551,7 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass { return null; } if (this.expiryTime < 0){ - return this.expiryTime / -84600000; + return this.expiryTime / -86400000; } return moment(this.expiryTime); } @@ -1685,7 +1685,7 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass { return null; } if (this.expiryTime < 0){ - return this.expiryTime / -84600000; + return this.expiryTime / -86400000; } return moment(this.expiryTime); } diff --git a/web/html/xui/client_bulk_modal.html b/web/html/xui/client_bulk_modal.html index f99e0c7c..2328e35d 100644 --- a/web/html/xui/client_bulk_modal.html +++ b/web/html/xui/client_bulk_modal.html @@ -173,10 +173,10 @@ return this.clientsBulkModal.inbound; }, get delayedExpireDays() { - return this.clientsBulkModal.expiryTime < 0 ? this.clientsBulkModal.expiryTime / -84600000 : 0; + return this.clientsBulkModal.expiryTime < 0 ? this.clientsBulkModal.expiryTime / -86400000 : 0; }, set delayedExpireDays(days){ - this.clientsBulkModal.expiryTime = -84600000 * days; + this.clientsBulkModal.expiryTime = -86400000 * days; }, }, }); diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index 8b16a159..7b207244 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -101,10 +101,10 @@ else return 'red' }, get delayedExpireDays() { - return this.client && this.client.expiryTime < 0 ? this.client.expiryTime / -84600000 : 0; + return this.client && this.client.expiryTime < 0 ? this.client.expiryTime / -86400000 : 0; }, set delayedExpireDays(days){ - this.client.expiryTime = -84600000 * days; + this.client.expiryTime = -86400000 * days; }, }, methods: { diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index ffa5998e..1ba15b08 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -96,7 +96,7 @@ [[ DateUtil.formatMillis(infoModal.clientSettings.expiryTime) ]] - [[ infoModal.clientSettings.expiryTime / -84600000 ]] {{ i18n "pages.client.days" }} + [[ infoModal.clientSettings.expiryTime / -86400000 ]] {{ i18n "pages.client.days" }} {{ i18n "indefinite" }} diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 05efb470..f9f1a9ef 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -310,7 +310,7 @@ if (!msg.success) { return; } - this.expireDiff = msg.obj.expireDiff * 84600000; + this.expireDiff = msg.obj.expireDiff * 86400000; this.trafficDiff = msg.obj.trafficDiff * 1073741824; }, setInbounds(dbInbounds) { diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 6204ed14..fe7f02d1 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -379,7 +379,7 @@ func (t *Tgbot) getClientUsage(chatId int64, tgUserName string) { if traffic.ExpiryTime == 0 { expiryTime = "♾Unlimited" } else if traffic.ExpiryTime < 0 { - expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-84600000) + expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-86400000) } else { expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05") } @@ -415,7 +415,7 @@ func (t *Tgbot) searchClient(chatId int64, email string) { if traffic.ExpiryTime == 0 { expiryTime = "♾Unlimited" } else if traffic.ExpiryTime < 0 { - expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-84600000) + expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-86400000) } else { expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05") } @@ -455,7 +455,7 @@ func (t *Tgbot) searchInbound(chatId int64, remark string) { if traffic.ExpiryTime == 0 { expiryTime = "♾Unlimited" } else if traffic.ExpiryTime < 0 { - expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-84600000) + expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-86400000) } else { expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05") } @@ -490,7 +490,7 @@ func (t *Tgbot) searchForClient(chatId int64, query string) { if traffic.ExpiryTime == 0 { expiryTime = "♾Unlimited" } else if traffic.ExpiryTime < 0 { - expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-84600000) + expiryTime = fmt.Sprintf("%d days", traffic.ExpiryTime/-86400000) } else { expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05") } @@ -521,7 +521,7 @@ func (t *Tgbot) getExhausted() string { } ExpireThreshold, err := t.settingService.GetExpireDiff() if err == nil && ExpireThreshold > 0 { - exDiff = int64(ExpireThreshold) * 84600000 + exDiff = int64(ExpireThreshold) * 86400000 } inbounds, err := t.inboundService.GetAllInbounds() if err != nil { @@ -569,7 +569,7 @@ func (t *Tgbot) getExhausted() string { if traffic.ExpiryTime == 0 { expiryTime = "♾Unlimited" } else if traffic.ExpiryTime < 0 { - expiryTime += fmt.Sprintf("%d days", traffic.ExpiryTime/-84600000) + expiryTime += fmt.Sprintf("%d days", traffic.ExpiryTime/-86400000) } else { expiryTime = time.Unix((traffic.ExpiryTime / 1000), 0).Format("2006-01-02 15:04:05") }