no message

This commit is contained in:
hellcat 2025-12-30 18:57:14 +08:00
parent c490b7dde0
commit c882583d57
8 changed files with 109 additions and 109 deletions

View File

@ -408,28 +408,28 @@ final class Cron
if ($node->getNodeOnlineStatus() === -1 && $node->online === 1) {
echo 'Send Node Offline Email to admin users' . PHP_EOL;
try {
Notification::notifyAdmin(
$_ENV['appName'] . '-系统警告',
'管理员你好,系统发现节点 ' . $node->name . ' 掉线了,请你及时处理。'
);
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
echo $e->getMessage() . PHP_EOL;
}
if (Config::obtain('telegram_node_offline')) {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::obtain('telegram_node_offline_text')
);
try {
(new Telegram())->send(0, $notice_text);
} catch (TelegramSDKException $e) {
echo $e->getMessage();
}
}
// try {
// Notification::notifyAdmin(
// $_ENV['appName'] . '-系统警告',
// '管理员你好,系统发现节点 ' . $node->name . ' 掉线了,请你及时处理。'
// );
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
// echo $e->getMessage() . PHP_EOL;
// }
//
// if (Config::obtain('telegram_node_offline')) {
// $notice_text = str_replace(
// '%node_name%',
// $node->name,
// Config::obtain('telegram_node_offline_text')
// );
//
// try {
// (new Telegram())->send(0, $notice_text);
// } catch (TelegramSDKException $e) {
// echo $e->getMessage();
// }
// }
$node->online = 0;
$node->save();
@ -440,28 +440,28 @@ final class Cron
if ($node->getNodeOnlineStatus() === 1 && $node->online === 0) {
echo 'Send Node Online Email to admin user' . PHP_EOL;
try {
Notification::notifyAdmin(
$_ENV['appName'] . '-系统提示',
'管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
);
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
echo $e->getMessage() . PHP_EOL;
}
// try {
// Notification::notifyAdmin(
// $_ENV['appName'] . '-系统提示',
// '管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
// );
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
// echo $e->getMessage() . PHP_EOL;
// }
if (Config::obtain('telegram_node_online')) {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::obtain('telegram_node_online_text')
);
try {
(new Telegram())->send(0, $notice_text);
} catch (TelegramSDKException $e) {
echo $e->getMessage();
}
}
// if (Config::obtain('telegram_node_online')) {
// $notice_text = str_replace(
// '%node_name%',
// $node->name,
// Config::obtain('telegram_node_online_text')
// );
//
// try {
// (new Telegram())->send(0, $notice_text);
// } catch (TelegramSDKException $e) {
// echo $e->getMessage();
// }
// }
$node->online = 1;
$node->save();

View File

@ -324,28 +324,28 @@ final class Cron
if ($node->getNodeOnlineStatus() === 1 && $node->online === 0) {
echo 'Send Node Online Email to admin user' . PHP_EOL;
try {
Notification::notifyAdmin(
$_ENV['appName'] . '-系统提示',
'管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
);
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
echo $e->getMessage() . PHP_EOL;
}
// try {
// Notification::notifyAdmin(
// $_ENV['appName'] . ' - 系统提示',
// '管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
// );
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
// echo $e->getMessage() . PHP_EOL;
// }
if (Config::obtain('telegram_node_online')) {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::obtain('telegram_node_online_text')
);
try {
(new Telegram())->send(0, $notice_text);
} catch (TelegramSDKException $e) {
echo $e->getMessage();
}
}
// if (Config::obtain('telegram_node_online')) {
// $notice_text = str_replace(
// '%node_name%',
// $node->name,
// Config::obtain('telegram_node_online_text')
// );
//
// try {
// (new Telegram())->send(0, $notice_text);
// } catch (TelegramSDKException $e) {
// echo $e->getMessage();
// }
// }
$node->online = 1;
$node->save();

View File

@ -51,24 +51,24 @@ final class Detect
echo '检测到节点 #' . $node->id . ' 被 GFW 封锁' . PHP_EOL;
echo 'Send gfw mail to admin' . PHP_EOL;
try {
Notification::notifyAdmin(
$_ENV['appName'] . '-系统警告',
'管理员你好,系统发现节点 ' . $node->name . ' 被墙了。'
);
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
echo $e->getMessage() . PHP_EOL;
}
if (Config::obtain('telegram_node_gfwed')) {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::obtain('telegram_node_gfwed_text')
);
(new Telegram())->send(0, $notice_text);
}
// try {
// Notification::notifyAdmin(
// $_ENV['appName'] . '-系统警告',
// '管理员你好,系统发现节点 ' . $node->name . ' 被墙了。'
// );
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
// echo $e->getMessage() . PHP_EOL;
// }
//
// if (Config::obtain('telegram_node_gfwed')) {
// $notice_text = str_replace(
// '%node_name%',
// $node->name,
// Config::obtain('telegram_node_gfwed_text')
// );
//
// (new Telegram())->send(0, $notice_text);
// }
$node->gfw_block = true;
$node->save();
@ -80,24 +80,24 @@ final class Detect
echo '检测到节点 #' . $node->id . ' 被 GFW 解除封锁' . PHP_EOL;
echo 'Send gfw mail to admin' . PHP_EOL;
try {
Notification::notifyAdmin(
$_ENV['appName'] . '-系统提示',
'管理员你好,系统发现节点 ' . $node->name . ' 溜出墙了。'
);
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
echo $e->getMessage() . PHP_EOL;
}
if (Config::obtain('telegram_node_ungfwed')) {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::obtain('telegram_node_ungfwed_text')
);
(new Telegram())->send(0, $notice_text);
}
// try {
// Notification::notifyAdmin(
// $_ENV['appName'] . '-系统提示',
// '管理员你好,系统发现节点 ' . $node->name . ' 溜出墙了。'
// );
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
// echo $e->getMessage() . PHP_EOL;
// }
//
// if (Config::obtain('telegram_node_ungfwed')) {
// $notice_text = str_replace(
// '%node_name%',
// $node->name,
// Config::obtain('telegram_node_ungfwed_text')
// );
//
// (new Telegram())->send(0, $notice_text);
// }
$node->gfw_block = false;
$node->save();