From 59fc61c6b2eda8ce01a6d4d9a44e17e2a78f1721 Mon Sep 17 00:00:00 2001 From: BrettonYe <867057410@qq.com> Date: Thu, 12 Oct 2023 23:25:34 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80Add=20Node=20=20block=20relive=20fu?= =?UTF-8?q?nction=20&=20some=20langs/content=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/NodeStatusDetection.php | 34 ++++++++++- app/Utils/CurrencyExchange.php | 1 + resources/lang/ja/common.php | 4 +- resources/views/auth/layouts.blade.php | 60 ++++++++++---------- resources/views/auth/login.blade.php | 4 +- 5 files changed, 69 insertions(+), 34 deletions(-) diff --git a/app/Console/Commands/NodeStatusDetection.php b/app/Console/Commands/NodeStatusDetection.php index 235da0cb..577fcb2d 100644 --- a/app/Console/Commands/NodeStatusDetection.php +++ b/app/Console/Commands/NodeStatusDetection.php @@ -88,6 +88,8 @@ class NodeStatusDetection extends Command if ($node->detection_type !== 2 && $status['tcp'] !== 1) { $data[$node_id][$ip]['tcp'] = config('common.network_status')[$status['tcp']]; } + + sleep(2); } } @@ -115,8 +117,6 @@ class NodeStatusDetection extends Command if (isset($data[$node_id])) { $data[$node_id]['name'] = $node->name; } - - sleep(5); } if (isset($data)) { //只有在出现阻断线路时,才会发出警报 @@ -126,5 +126,35 @@ class NodeStatusDetection extends Command } Cache::put('LastCheckTime', time() + random_int(3000, Hour), 3700); // 随机生成下次检测时间 + + $this->reliveNode(); + } + + private function reliveNode(): void + { + $onlineNode = NodeHeartbeat::recently()->distinct()->pluck('node_id')->toArray(); + foreach (Node::whereRelayNodeId(null)->whereStatus(0)->whereIn('id', $onlineNode)->where('detection_type', '<>', 0)->get() as $node) { + $ips = $node->ips(); + $result = count($ips); + foreach ($ips as $ip) { + if ($node->detection_type) { + $status = (new NetworkDetection)->networkStatus($ip, $node->port ?? 22); + + if ($node->detection_type === 1 && $status['tcp'] === 1) { + $result--; + } elseif ($node->detection_type === 2 && $status['icmp'] === 1) { + $result--; + } elseif ($status['tcp'] === 1 && $status['icmp'] === 1) { + $result--; + } + + sleep(1); + } + } + + if ($result === 0) { + $node->update(['status' => 1]); + } + } } } diff --git a/app/Utils/CurrencyExchange.php b/app/Utils/CurrencyExchange.php index cac92438..3d1b3aa0 100644 --- a/app/Utils/CurrencyExchange.php +++ b/app/Utils/CurrencyExchange.php @@ -11,6 +11,7 @@ use Log; class CurrencyExchange { private static PendingRequest $basicRequest; + private static array $apis = ['fixer', 'exchangerateApi', 'wise', 'currencyData', 'exchangeRatesData', 'duckduckgo', 'wsj', 'valutafx', 'baidu', 'unionpay', 'exchangerate', 'jsdelivrFile', 'it120', 'k780']; /** diff --git a/resources/lang/ja/common.php b/resources/lang/ja/common.php index 5cf73b4c..d6cc7331 100644 --- a/resources/lang/ja/common.php +++ b/resources/lang/ja/common.php @@ -82,7 +82,7 @@ return [ 'print' => '印刷', 'unlimited' => '無制限', 'payment' => [ - 'credit' => 'クレジット', + 'credit' => '残高', 'alipay' => 'Alipay', 'qq' => 'QQウォレット', 'wechat' => 'WeChatペイ', @@ -134,7 +134,7 @@ return [ 'paid' => '支払済み', 'payment_pending' => '支払保留中', 'pass' => 'パス', - 'send_to_credit' => 'クレジットに入金', + 'send_to_credit' => '残高への支払い', 'waiting_tobe_send' => '配信待ち', ], 'stay_unchanged' => '空欄のままで変更なし', diff --git a/resources/views/auth/layouts.blade.php b/resources/views/auth/layouts.blade.php index 99388c39..19c7a449 100644 --- a/resources/views/auth/layouts.blade.php +++ b/resources/views/auth/layouts.blade.php @@ -4,43 +4,45 @@ @yield('css') - + #ad > button { + position: absolute; + right: 0; + top: 0; + } + + @endif @endsection @section('body_class', 'page-login-v3 layout-full position-relative') @section('layout_content') diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 66f13ff2..43510f04 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -80,5 +80,7 @@ @endswitch }); - + @if(config('app.env') === 'demo') + + @endif @endsection