[bug] fix time calculation #143

This commit is contained in:
Alireza Ahmadi
2023-04-05 09:36:23 +02:00
parent d0ce67a8f0
commit 38db94f507
6 changed files with 15 additions and 15 deletions

View File

@@ -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);
}

View File

@@ -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;
},
},
});

View File

@@ -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: {

View File

@@ -96,7 +96,7 @@
[[ DateUtil.formatMillis(infoModal.clientSettings.expiryTime) ]]
</a-tag>
</template>
<a-tag v-else-if="infoModal.clientSettings.expiryTime < 0" color="cyan">[[ infoModal.clientSettings.expiryTime / -84600000 ]] {{ i18n "pages.client.days" }}</a-tag>
<a-tag v-else-if="infoModal.clientSettings.expiryTime < 0" color="cyan">[[ infoModal.clientSettings.expiryTime / -86400000 ]] {{ i18n "pages.client.days" }}</a-tag>
<a-tag v-else color="green">{{ i18n "indefinite" }}</a-tag>
</td>
</tr>

View File

@@ -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) {

View File

@@ -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")
}