фикс настройки уведов о просрочке
This commit is contained in:
parent
de22b30321
commit
59f90aaa5c
23
Program.cs
23
Program.cs
@ -92,8 +92,8 @@ class Program
|
||||
|
||||
private static async Task MonitorReportStatus(long reportId, CancellationToken token)
|
||||
{
|
||||
// Ждем 15 секунд перед первой проверкой
|
||||
await Task.Delay(15000, token);
|
||||
// Ждем 1 час перед первой проверкой
|
||||
await Task.Delay(TimeSpan.FromHours(1), token);
|
||||
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
@ -117,7 +117,16 @@ class Program
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var adminId in admins)
|
||||
var getAdminsCommand = connection.CreateCommand();
|
||||
getAdminsCommand.CommandText = "SELECT ChatId, NotifyOnPendingReports FROM Admins";
|
||||
using (var reader = await getAdminsCommand.ExecuteReaderAsync())
|
||||
{
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
long adminId = reader.GetInt64(0);
|
||||
bool notifyOnPendingReports = reader.GetInt32(1) == 1;
|
||||
|
||||
if (notifyOnPendingReports)
|
||||
{
|
||||
await _botClient.SendMessage(
|
||||
chatId: adminId,
|
||||
@ -126,17 +135,20 @@ class Program
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Ошибка при мониторинге статуса заявки #{reportId}: {ex.Message}");
|
||||
}
|
||||
|
||||
// Ждем 15 секунд перед следующей проверкой
|
||||
await Task.Delay(15000, token);
|
||||
// Ждем 1 час перед следующей проверкой
|
||||
await Task.Delay(TimeSpan.FromHours(1), token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static async Task DeletePreviousMessage(ITelegramBotClient botClient, long chatId, int messageId)
|
||||
{
|
||||
try
|
||||
@ -1370,6 +1382,7 @@ class Program
|
||||
|
||||
|
||||
|
||||
|
||||
private static async Task NotifyAdminsAboutWorkAssignment(long reportId, long changerId)
|
||||
{
|
||||
try
|
||||
|
Loading…
x
Reference in New Issue
Block a user