瀏覽代碼

🚀Add Node block relive function & some langs/content fix

BrettonYe 2 年之前
父節點
當前提交
59fc61c6b2

+ 32 - 2
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]);
+            }
+        }
     }
 }

+ 1 - 0
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'];
 
     /**

+ 2 - 2
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' => '空欄のままで変更なし',

+ 31 - 29
resources/views/auth/layouts.blade.php

@@ -4,43 +4,45 @@
     <link href="/assets/global/fonts/font-awesome/css/all.min.css" rel="stylesheet">
     <link href="/assets/css/login-v3.min.css" rel="stylesheet">
     @yield('css')
-    <style>
-        @media (max-width: 768px) {
-            #ad img {
-                width: 40vw;
+    @if (config('version.ads'))
+        <style>
+            @media (max-width: 768px) {
+                #ad img {
+                    width: 40vw;
+                }
             }
-        }
 
-        @media (min-width: 768px) {
-            #ad img {
-                width: 30vw;
+            @media (min-width: 768px) {
+                #ad img {
+                    width: 30vw;
+                }
             }
-        }
 
-        @media (min-width: 1200px) {
-            #ad img {
-                width: 20vw;
+            @media (min-width: 1200px) {
+                #ad img {
+                    width: 20vw;
+                }
             }
-        }
 
-        #ad {
-            position: fixed;
-            z-index: 9999;
-            left: 0;
-            bottom: 0;
-            background-color:rgba(255,255,255,0.80);
-        }
+            #ad {
+                position: fixed;
+                z-index: 9999;
+                left: 0;
+                bottom: 0;
+                background-color: rgba(255, 255, 255, 0.80);
+            }
 
-        #ad img {
-            max-width: 300px;
-        }
+            #ad img {
+                max-width: 300px;
+            }
 
-        #ad > button {
-            position: absolute;
-            right: 0;
-            top: 0;
-        }
-    </style>
+            #ad > button {
+                position: absolute;
+                right: 0;
+                top: 0;
+            }
+        </style>
+    @endif
 @endsection
 @section('body_class', 'page-login-v3 layout-full position-relative')
 @section('layout_content')

+ 3 - 1
resources/views/auth/login.blade.php

@@ -80,5 +80,7 @@
           @endswitch
       });
     </script>
-    <script src="https://ad.ddo.jp/728x90.js.php?ddo_id=proxypanel&ddo_i={{(int) floor(time() / 60)}}" type="text/javascript" defer></script>
+    @if(config('app.env') === 'demo')
+        <script src="https://ad.ddo.jp/728x90.js.php?ddo_id=proxypanel&ddo_i={{(int) floor(time() / 60)}}" type="text/javascript" defer></script>
+    @endif
 @endsection