Ver código fonte

1.修正定时清除日志错误
2.节点30-60分钟随机进行TCP阻断检测
3.在线安装shadowrocket

admin 7 anos atrás
pai
commit
9c9fdc9526

+ 1 - 0
.gitignore

@@ -9,6 +9,7 @@
 /vendor
 /.idea
 /.vagrant
+/.vscode
 Homestead.json
 Homestead.yaml
 npm-debug.log

+ 10 - 5
app/Console/Commands/AutoCheckNodeStatus.php

@@ -30,7 +30,11 @@ class AutoCheckNodeStatus extends Command
 
         // 监测节点状态
         if (self::$systemConfig['is_tcp_check']) {
-            $this->checkNodes();
+            if (!Cache::has('tcp_check_time')) {
+                $this->checkNodes();
+            } elseif (Cache::get('tcp_check_time') <= time()) {
+                $this->checkNodes();
+            }
         }
 
         $jobEndTime = microtime(true);
@@ -71,7 +75,7 @@ class AutoCheckNodeStatus extends Command
                         if (Cache::has($cacheKey)) {
                             $times = Cache::get($cacheKey);
                         } else {
-                            Cache::put($cacheKey, 1, 725); // 因为每小时检测一次,最多设置提醒12次,12*60=720分钟缓存时效,多5分钟防止异常
+                            Cache::put($cacheKey, 1, 725); // 最多设置提醒12次,12*60=720分钟缓存时效,多5分钟防止异常
                             $times = 1;
                         }
 
@@ -98,10 +102,11 @@ class AutoCheckNodeStatus extends Command
             if ($tcpCheck !== 1 && !$nodeTTL) {
                 $this->notifyMaster($title, "节点**{$node->name}【{$node->ip}】**异常:**心跳异常**", $node->name, $node->server);
             }
-
-            // 天若有情天亦老,我为长者续一秒
-            sleep(1);
         }
+
+        // 随机生成下次检测时间
+        $nextCheckTime = time() + mt_rand(1800, 3600);
+        Cache::put('tcp_check_time', $nextCheckTime, 60);
     }
 
     /**

+ 1 - 1
app/Console/Commands/AutoClearLog.php

@@ -58,7 +58,7 @@ class AutoClearLog extends Command
         SsNodeTrafficHourly::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-60 days')))->delete();
 
         // 自动清除30天以前用户封禁日志
-        UserBanLog::query()->where('created_at', '<=', strtotime(date('Y-m-d H:i:s', strtotime("-30 days"))))->delete();
+        UserBanLog::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-30 days")))->delete();
     }
 
 }

+ 1 - 0
app/Http/Controllers/UserController.php

@@ -68,6 +68,7 @@ class UserController extends Controller
         $view['website_customer_service'] = self::$systemConfig['website_customer_service'];
         $view['is_push_bear'] = self::$systemConfig['is_push_bear'];
         $view['push_bear_qrcode'] = self::$systemConfig['push_bear_qrcode'];
+        $view['ipa_list'] = 'itms-services://?action=download-manifest&url=' . self::$systemConfig['website_url'] . '/clients/ipa.plist';
         $view['goodsList'] = Goods::query()->where('type', 3)->where('status', 1)->where('is_del', 0)->orderBy('sort', 'desc')->orderBy('price', 'asc')->limit(10)->get(); // 余额充值商品,只取10个
 
         // 推广返利是否可见

BIN
public/clients/Shadowrocket_2.1.23.ipa


+ 30 - 0
public/clients/ipa.plist

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+    <dict>
+        <key>items</key>
+        <array>
+            <dict>
+                <key>assets</key>
+                <array>
+                    <dict>
+                        <key>kind</key>
+                        <string>software-package</string>
+                        <key>url</key>
+                        <string>http://demo.ssrpanel.com/clients/Shadowrocket_2.1.23.ipa</string>
+                    </dict>
+                </array>
+                <key>metadata</key>
+                <dict>
+                    <key>bundle-identifier</key>
+                     <string>com.liguangming.Shadowrocket</string>
+                     <key>bundle-version</key>
+                    <string>2.1.23</string>
+                    <key>kind</key>
+                    <string>software</string>
+                    <key>title</key>
+                    <string>Shadowrocket</string>
+                </dict>
+            </dict>
+        </array>
+    </dict>
+</plist>

+ 3 - 0
resources/views/user/index.blade.php

@@ -125,6 +125,9 @@
                                             </div>
                                             <div class="tab-pane" id="tools4">
                                                 <ol>
+                                                    @if(Agent::is('iPhone') || Agent::is('iPad'))
+                                                        <li> <a href="{{$ipa_list}}" target="_blank">点击此处在线安装</a></li>
+                                                    @endif
                                                     <li> 请从站长处获取App Store美区ID及教程 </li>
                                                 </ol>
                                             </div>