mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-12 05:00:05 +00:00
format document
This commit is contained in:
parent
8aa6edbf94
commit
33252b3be6
2 changed files with 13 additions and 15 deletions
|
@ -3,10 +3,10 @@ package service
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"sort"
|
||||
|
||||
"x-ui/database"
|
||||
"x-ui/database/model"
|
||||
|
@ -2027,7 +2027,6 @@ func (s *InboundService) GetOnlineClients() []string {
|
|||
return p.GetOnlineClients()
|
||||
}
|
||||
|
||||
|
||||
func (s *InboundService) FilterAndSortClientEmails(emails []string) ([]string, []string, error) {
|
||||
db := database.GetDB()
|
||||
|
||||
|
|
|
@ -1074,7 +1074,6 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool
|
|||
count, _ := strconv.Atoi(dataArray[1])
|
||||
client_LimitIP = count
|
||||
}
|
||||
|
||||
|
||||
messageId := callbackQuery.Message.GetMessageID()
|
||||
inbound, err := t.inboundService.GetInbound(receiver_inbound_ID)
|
||||
|
@ -1560,7 +1559,7 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool
|
|||
t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.answers.errorOperation"), tu.ReplyKeyboardRemove())
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
for _, email := range emails {
|
||||
err := t.inboundService.ResetClientTrafficByEmail(email)
|
||||
if err == nil {
|
||||
|
@ -1571,18 +1570,18 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool
|
|||
t.SendMsgToTgbot(chatId, msg, tu.ReplyKeyboardRemove())
|
||||
}
|
||||
}
|
||||
|
||||
t.SendMsgToTgbot(chatId,t.I18nBot("tgbot.messages.FinishProcess"), tu.ReplyKeyboardRemove())
|
||||
|
||||
t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.messages.FinishProcess"), tu.ReplyKeyboardRemove())
|
||||
case "get_sorted_traffic_usage_report":
|
||||
t.deleteMessageTgBot(chatId, callbackQuery.Message.GetMessageID())
|
||||
emails, err := t.inboundService.getAllEmails()
|
||||
|
||||
|
||||
if err != nil {
|
||||
t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.answers.errorOperation"), tu.ReplyKeyboardRemove())
|
||||
return
|
||||
}
|
||||
valid_emails ,extra_emails, err := t.inboundService.FilterAndSortClientEmails(emails)
|
||||
|
||||
valid_emails, extra_emails, err := t.inboundService.FilterAndSortClientEmails(emails)
|
||||
|
||||
for _, valid_emails := range valid_emails {
|
||||
traffic, err := t.inboundService.GetClientTrafficByEmail(valid_emails)
|
||||
if err != nil {
|
||||
|
@ -1599,11 +1598,11 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool
|
|||
|
||||
output := t.clientInfoMsg(traffic, false, false, false, false, true, false)
|
||||
t.SendMsgToTgbot(chatId, output, tu.ReplyKeyboardRemove())
|
||||
}
|
||||
}
|
||||
for _, extra_emails := range extra_emails {
|
||||
msg := fmt.Sprintf("📧 %s\n%s", extra_emails, t.I18nBot("tgbot.noResult"))
|
||||
msg := fmt.Sprintf("📧 %s\n%s", extra_emails, t.I18nBot("tgbot.noResult"))
|
||||
t.SendMsgToTgbot(chatId, msg, tu.ReplyKeyboardRemove())
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1642,13 +1641,13 @@ func (t *Tgbot) BuildInboundClientDataMessage(inbound_remark string, protocol mo
|
|||
|
||||
switch protocol {
|
||||
case model.VMESS, model.VLESS:
|
||||
message = t.I18nBot("tgbot.messages.inbound_client_data_id", "InboundRemark=="+inbound_remark, "ClientId=="+client_Id, "ClientEmail=="+client_Email, "ClientTraffic=="+traffic_value, "ClientExp=="+expiryTime,"IpLimit=="+ip_limit ,"ClientComment=="+client_Comment)
|
||||
message = t.I18nBot("tgbot.messages.inbound_client_data_id", "InboundRemark=="+inbound_remark, "ClientId=="+client_Id, "ClientEmail=="+client_Email, "ClientTraffic=="+traffic_value, "ClientExp=="+expiryTime, "IpLimit=="+ip_limit, "ClientComment=="+client_Comment)
|
||||
|
||||
case model.Trojan:
|
||||
message = t.I18nBot("tgbot.messages.inbound_client_data_pass", "InboundRemark=="+inbound_remark, "ClientPass=="+client_TrPassword, "ClientEmail=="+client_Email, "ClientTraffic=="+traffic_value, "ClientExp=="+expiryTime,"IpLimit=="+ip_limit , "ClientComment=="+client_Comment)
|
||||
message = t.I18nBot("tgbot.messages.inbound_client_data_pass", "InboundRemark=="+inbound_remark, "ClientPass=="+client_TrPassword, "ClientEmail=="+client_Email, "ClientTraffic=="+traffic_value, "ClientExp=="+expiryTime, "IpLimit=="+ip_limit, "ClientComment=="+client_Comment)
|
||||
|
||||
case model.Shadowsocks:
|
||||
message = t.I18nBot("tgbot.messages.inbound_client_data_pass", "InboundRemark=="+inbound_remark, "ClientPass=="+client_ShPassword, "ClientEmail=="+client_Email, "ClientTraffic=="+traffic_value, "ClientExp=="+expiryTime,"IpLimit=="+ip_limit , "ClientComment=="+client_Comment)
|
||||
message = t.I18nBot("tgbot.messages.inbound_client_data_pass", "InboundRemark=="+inbound_remark, "ClientPass=="+client_ShPassword, "ClientEmail=="+client_Email, "ClientTraffic=="+traffic_value, "ClientExp=="+expiryTime, "IpLimit=="+ip_limit, "ClientComment=="+client_Comment)
|
||||
|
||||
default:
|
||||
return "", errors.New("unknown protocol")
|
||||
|
|
Loading…
Reference in a new issue