no message
This commit is contained in:
parent
c490b7dde0
commit
c882583d57
@ -408,28 +408,28 @@ final class Cron
|
|||||||
if ($node->getNodeOnlineStatus() === -1 && $node->online === 1) {
|
if ($node->getNodeOnlineStatus() === -1 && $node->online === 1) {
|
||||||
echo 'Send Node Offline Email to admin users' . PHP_EOL;
|
echo 'Send Node Offline Email to admin users' . PHP_EOL;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
Notification::notifyAdmin(
|
// Notification::notifyAdmin(
|
||||||
$_ENV['appName'] . '-系统警告',
|
// $_ENV['appName'] . '-系统警告',
|
||||||
'管理员你好,系统发现节点 ' . $node->name . ' 掉线了,请你及时处理。'
|
// '管理员你好,系统发现节点 ' . $node->name . ' 掉线了,请你及时处理。'
|
||||||
);
|
// );
|
||||||
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
||||||
echo $e->getMessage() . PHP_EOL;
|
// echo $e->getMessage() . PHP_EOL;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (Config::obtain('telegram_node_offline')) {
|
// if (Config::obtain('telegram_node_offline')) {
|
||||||
$notice_text = str_replace(
|
// $notice_text = str_replace(
|
||||||
'%node_name%',
|
// '%node_name%',
|
||||||
$node->name,
|
// $node->name,
|
||||||
Config::obtain('telegram_node_offline_text')
|
// Config::obtain('telegram_node_offline_text')
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
(new Telegram())->send(0, $notice_text);
|
// (new Telegram())->send(0, $notice_text);
|
||||||
} catch (TelegramSDKException $e) {
|
// } catch (TelegramSDKException $e) {
|
||||||
echo $e->getMessage();
|
// echo $e->getMessage();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
$node->online = 0;
|
$node->online = 0;
|
||||||
$node->save();
|
$node->save();
|
||||||
@ -440,28 +440,28 @@ final class Cron
|
|||||||
if ($node->getNodeOnlineStatus() === 1 && $node->online === 0) {
|
if ($node->getNodeOnlineStatus() === 1 && $node->online === 0) {
|
||||||
echo 'Send Node Online Email to admin user' . PHP_EOL;
|
echo 'Send Node Online Email to admin user' . PHP_EOL;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
Notification::notifyAdmin(
|
// Notification::notifyAdmin(
|
||||||
$_ENV['appName'] . '-系统提示',
|
// $_ENV['appName'] . '-系统提示',
|
||||||
'管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
|
// '管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
|
||||||
);
|
// );
|
||||||
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
||||||
echo $e->getMessage() . PHP_EOL;
|
// echo $e->getMessage() . PHP_EOL;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Config::obtain('telegram_node_online')) {
|
// if (Config::obtain('telegram_node_online')) {
|
||||||
$notice_text = str_replace(
|
// $notice_text = str_replace(
|
||||||
'%node_name%',
|
// '%node_name%',
|
||||||
$node->name,
|
// $node->name,
|
||||||
Config::obtain('telegram_node_online_text')
|
// Config::obtain('telegram_node_online_text')
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
(new Telegram())->send(0, $notice_text);
|
// (new Telegram())->send(0, $notice_text);
|
||||||
} catch (TelegramSDKException $e) {
|
// } catch (TelegramSDKException $e) {
|
||||||
echo $e->getMessage();
|
// echo $e->getMessage();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
$node->online = 1;
|
$node->online = 1;
|
||||||
$node->save();
|
$node->save();
|
||||||
|
|||||||
@ -324,28 +324,28 @@ final class Cron
|
|||||||
if ($node->getNodeOnlineStatus() === 1 && $node->online === 0) {
|
if ($node->getNodeOnlineStatus() === 1 && $node->online === 0) {
|
||||||
echo 'Send Node Online Email to admin user' . PHP_EOL;
|
echo 'Send Node Online Email to admin user' . PHP_EOL;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
Notification::notifyAdmin(
|
// Notification::notifyAdmin(
|
||||||
$_ENV['appName'] . '-系统提示',
|
// $_ENV['appName'] . ' - 系统提示',
|
||||||
'管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
|
// '管理员你好,系统发现节点 ' . $node->name . ' 恢复上线了。'
|
||||||
);
|
// );
|
||||||
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
||||||
echo $e->getMessage() . PHP_EOL;
|
// echo $e->getMessage() . PHP_EOL;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Config::obtain('telegram_node_online')) {
|
// if (Config::obtain('telegram_node_online')) {
|
||||||
$notice_text = str_replace(
|
// $notice_text = str_replace(
|
||||||
'%node_name%',
|
// '%node_name%',
|
||||||
$node->name,
|
// $node->name,
|
||||||
Config::obtain('telegram_node_online_text')
|
// Config::obtain('telegram_node_online_text')
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
(new Telegram())->send(0, $notice_text);
|
// (new Telegram())->send(0, $notice_text);
|
||||||
} catch (TelegramSDKException $e) {
|
// } catch (TelegramSDKException $e) {
|
||||||
echo $e->getMessage();
|
// echo $e->getMessage();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
$node->online = 1;
|
$node->online = 1;
|
||||||
$node->save();
|
$node->save();
|
||||||
|
|||||||
@ -51,24 +51,24 @@ final class Detect
|
|||||||
echo '检测到节点 #' . $node->id . ' 被 GFW 封锁' . PHP_EOL;
|
echo '检测到节点 #' . $node->id . ' 被 GFW 封锁' . PHP_EOL;
|
||||||
echo 'Send gfw mail to admin' . PHP_EOL;
|
echo 'Send gfw mail to admin' . PHP_EOL;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
Notification::notifyAdmin(
|
// Notification::notifyAdmin(
|
||||||
$_ENV['appName'] . '-系统警告',
|
// $_ENV['appName'] . '-系统警告',
|
||||||
'管理员你好,系统发现节点 ' . $node->name . ' 被墙了。'
|
// '管理员你好,系统发现节点 ' . $node->name . ' 被墙了。'
|
||||||
);
|
// );
|
||||||
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
||||||
echo $e->getMessage() . PHP_EOL;
|
// echo $e->getMessage() . PHP_EOL;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (Config::obtain('telegram_node_gfwed')) {
|
// if (Config::obtain('telegram_node_gfwed')) {
|
||||||
$notice_text = str_replace(
|
// $notice_text = str_replace(
|
||||||
'%node_name%',
|
// '%node_name%',
|
||||||
$node->name,
|
// $node->name,
|
||||||
Config::obtain('telegram_node_gfwed_text')
|
// Config::obtain('telegram_node_gfwed_text')
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
(new Telegram())->send(0, $notice_text);
|
// (new Telegram())->send(0, $notice_text);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$node->gfw_block = true;
|
$node->gfw_block = true;
|
||||||
$node->save();
|
$node->save();
|
||||||
@ -80,24 +80,24 @@ final class Detect
|
|||||||
echo '检测到节点 #' . $node->id . ' 被 GFW 解除封锁' . PHP_EOL;
|
echo '检测到节点 #' . $node->id . ' 被 GFW 解除封锁' . PHP_EOL;
|
||||||
echo 'Send gfw mail to admin' . PHP_EOL;
|
echo 'Send gfw mail to admin' . PHP_EOL;
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
Notification::notifyAdmin(
|
// Notification::notifyAdmin(
|
||||||
$_ENV['appName'] . '-系统提示',
|
// $_ENV['appName'] . '-系统提示',
|
||||||
'管理员你好,系统发现节点 ' . $node->name . ' 溜出墙了。'
|
// '管理员你好,系统发现节点 ' . $node->name . ' 溜出墙了。'
|
||||||
);
|
// );
|
||||||
} catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
// } catch (GuzzleException|ClientExceptionInterface|TelegramSDKException $e) {
|
||||||
echo $e->getMessage() . PHP_EOL;
|
// echo $e->getMessage() . PHP_EOL;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (Config::obtain('telegram_node_ungfwed')) {
|
// if (Config::obtain('telegram_node_ungfwed')) {
|
||||||
$notice_text = str_replace(
|
// $notice_text = str_replace(
|
||||||
'%node_name%',
|
// '%node_name%',
|
||||||
$node->name,
|
// $node->name,
|
||||||
Config::obtain('telegram_node_ungfwed_text')
|
// Config::obtain('telegram_node_ungfwed_text')
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
(new Telegram())->send(0, $notice_text);
|
// (new Telegram())->send(0, $notice_text);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$node->gfw_block = false;
|
$node->gfw_block = false;
|
||||||
$node->save();
|
$node->save();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user