mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-20 05:52:24 +00:00
Fix restart service
This commit is contained in:
parent
4b3bdebfa5
commit
c6295085fe
1 changed files with 22 additions and 13 deletions
|
@ -31,6 +31,7 @@ type Tgbot struct {
|
||||||
inboundService InboundService
|
inboundService InboundService
|
||||||
settingService SettingService
|
settingService SettingService
|
||||||
serverService ServerService
|
serverService ServerService
|
||||||
|
xrayService XrayService
|
||||||
lastStatus *Status
|
lastStatus *Status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,9 +172,14 @@ func (t *Tgbot) asnwerCallback(callbackQuery *tgbotapi.CallbackQuery, isAdmin bo
|
||||||
)
|
)
|
||||||
t.editMessageCallbackTgBot(callbackQuery.From.ID, callbackQuery.Message.MessageID, inlineKeyboard)
|
t.editMessageCallbackTgBot(callbackQuery.From.ID, callbackQuery.Message.MessageID, inlineKeyboard)
|
||||||
case "reset_traffic_confirm":
|
case "reset_traffic_confirm":
|
||||||
t.inboundService.ResetClientTrafficByEmail(email)
|
resetError := t.inboundService.ResetClientTrafficByEmail(email)
|
||||||
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("✅ %s : Traffic reset successfully.", email))
|
if resetError == nil {
|
||||||
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
t.xrayService.SetToNeedRestart()
|
||||||
|
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("✅ %s : Traffic reset successfully.", email))
|
||||||
|
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
||||||
|
} else {
|
||||||
|
t.sendCallbackAnswerTgBot(callbackQuery.ID, "❗ Error in Operation.")
|
||||||
|
}
|
||||||
case "reset_expire_days":
|
case "reset_expire_days":
|
||||||
var inlineKeyboard = tgbotapi.NewInlineKeyboardMarkup(
|
var inlineKeyboard = tgbotapi.NewInlineKeyboardMarkup(
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
|
@ -184,15 +190,15 @@ func (t *Tgbot) asnwerCallback(callbackQuery *tgbotapi.CallbackQuery, isAdmin bo
|
||||||
),
|
),
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("1 Month", "reset_expire_days_confirm "+email+" 30"),
|
tgbotapi.NewInlineKeyboardButtonData("1 Month", "reset_expire_days_confirm "+email+" 30"),
|
||||||
tgbotapi.NewInlineKeyboardButtonData("2 Month", "reset_expire_days_confirm "+email+" 60"),
|
tgbotapi.NewInlineKeyboardButtonData("2 Months", "reset_expire_days_confirm "+email+" 60"),
|
||||||
),
|
),
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("3 Month", "reset_expire_days_confirm "+email+" 90"),
|
tgbotapi.NewInlineKeyboardButtonData("3 Months", "reset_expire_days_confirm "+email+" 90"),
|
||||||
tgbotapi.NewInlineKeyboardButtonData("6 Month", "reset_expire_days_confirm "+email+" 180"),
|
tgbotapi.NewInlineKeyboardButtonData("6 Months", "reset_expire_days_confirm "+email+" 180"),
|
||||||
),
|
),
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("9 Month", "reset_expire_days_confirm "+email+" 270"),
|
tgbotapi.NewInlineKeyboardButtonData("9 Months", "reset_expire_days_confirm "+email+" 270"),
|
||||||
tgbotapi.NewInlineKeyboardButtonData("12 Month", "reset_expire_days_confirm "+email+" 360"),
|
tgbotapi.NewInlineKeyboardButtonData("12 Months", "reset_expire_days_confirm "+email+" 360"),
|
||||||
),
|
),
|
||||||
tgbotapi.NewInlineKeyboardRow(
|
tgbotapi.NewInlineKeyboardRow(
|
||||||
tgbotapi.NewInlineKeyboardButtonData("10 Days", "reset_expire_days_confirm "+email+" 10"),
|
tgbotapi.NewInlineKeyboardButtonData("10 Days", "reset_expire_days_confirm "+email+" 10"),
|
||||||
|
@ -203,15 +209,18 @@ func (t *Tgbot) asnwerCallback(callbackQuery *tgbotapi.CallbackQuery, isAdmin bo
|
||||||
case "reset_expire_days_confirm":
|
case "reset_expire_days_confirm":
|
||||||
err := len(dataArray) < 3
|
err := len(dataArray) < 3
|
||||||
if !err {
|
if !err {
|
||||||
days, error := strconv.Atoi(dataArray[2])
|
days, err2 := strconv.Atoi(dataArray[2])
|
||||||
if error == nil {
|
if err2 == nil {
|
||||||
var date int64 = 0
|
var date int64 = 0
|
||||||
if days > 0 {
|
if days > 0 {
|
||||||
date = int64(-(days * 24 * 60 * 60000))
|
date = int64(-(days * 24 * 60 * 60000))
|
||||||
}
|
}
|
||||||
t.inboundService.ResetClientExpiryTimeByEmail(email, date)
|
resetError := t.inboundService.ResetClientExpiryTimeByEmail(email, date)
|
||||||
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("✅ %s : Expire days reset successfully.", email))
|
if resetError == nil {
|
||||||
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
t.xrayService.SetToNeedRestart()
|
||||||
|
t.sendCallbackAnswerTgBot(callbackQuery.ID, fmt.Sprintf("✅ %s : Expire days reset successfully.", email))
|
||||||
|
t.searchClient(callbackQuery.From.ID, email, callbackQuery.Message.MessageID)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
err = true
|
err = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue