Bläddra i källkod

优化统计任务时间

兔姬桑 4 år sedan
förälder
incheckning
c2a887ad21

+ 4 - 7
app/Components/NetworkDetection.php

@@ -130,7 +130,7 @@ class NetworkDetection
             }
 
             if (! $message['success']) {
-                if ($message['error'] && $message['error'] === 'execute timeout (3s)') {
+                if (isset($message['error']) && $message['error'] === 'execute timeout (3s)') {
                     return false;
                 }
 
@@ -233,9 +233,8 @@ class NetworkDetection
         return false;
     }
 
-    // 来源:https://www.idcoffer.com/ipcheck
     private function idcoffer(string $ip, bool $is_icmp, int $port = null)
-    {
+    { // 来源:https://www.idcoffer.com/ipcheck
         $cn = "https://api.24kplus.com/ipcheck?host={$ip}&port={$port}";
         $us = "https://api.idcoffer.com/ipcheck?host={$ip}&port={$port}";
         $checkName = $is_icmp ? 'ping' : 'tcp';
@@ -276,9 +275,8 @@ class NetworkDetection
         return false;
     }
 
-    // 来源:https://ping.gd/
     private function gd(string $ip, bool $is_icmp, int $port = 443)
-    {
+    { // 来源:https://ping.gd/
         $url = "https://ping.gd/api/ip-test/{$ip}:".($port ?? 443);
 
         $checkName = $is_icmp ? 'ping_alive' : 'telnet_alive';
@@ -311,9 +309,8 @@ class NetworkDetection
         return false;
     }
 
-    // 来源:https://ip112.cn/
     private function ip112(string $ip, bool $is_icmp, int $port = 443)
-    {
+    { // 来源:https://ip112.cn/
         $cn = 'https://api.zhujiquanzi.com/ipcheck/ipcheck.php';
         $us = 'https://api.52bwg.com/ipcheck/ipcheck.php';
         $checkName = $is_icmp ? 'icmp' : 'tcp';

+ 3 - 4
app/Console/Commands/AutoClearLogs.php

@@ -27,17 +27,16 @@ class AutoClearLogs extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         // 清除日志
         if (sysConfig('is_clear_log')) {
             $this->clearLog();
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     // 清除日志

+ 3 - 4
app/Console/Commands/AutoJob.php

@@ -23,7 +23,7 @@ class AutoJob extends Command
      */
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         Order::recentUnPay()->update(['status' => -1]); // 关闭超时未支付本地订单
         $this->expireCode(); //过期验证码、优惠券、邀请码无效化
@@ -43,10 +43,9 @@ class AutoJob extends Command
             Config::whereIn('name', ['maintenance_mode', 'maintenance_content', 'maintenance_time'])->update(['value' => null]);
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function expireCode()// 注册验证码自动置无效 & 优惠券无效化

+ 3 - 4
app/Console/Commands/DailyJob.php

@@ -17,7 +17,7 @@ class DailyJob extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         $this->expireUser(); // 过期用户处理
         $this->closeTickets(); // 关闭用户超时未处理的工单
@@ -26,10 +26,9 @@ class DailyJob extends Command
             $this->resetUserTraffic();
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function expireUser()// 过期用户处理

+ 3 - 4
app/Console/Commands/DailyNodeReport.php

@@ -16,7 +16,7 @@ class DailyNodeReport extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         if (sysConfig('node_daily_notification')) {
             $nodeList = Node::whereStatus(1)->with('dailyDataFlows')->get();
@@ -48,9 +48,8 @@ class DailyNodeReport extends Command
             }
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 }

+ 11 - 9
app/Console/Commands/NodeDailyTrafficStatistics.php

@@ -13,30 +13,32 @@ class NodeDailyTrafficStatistics extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         foreach (Node::whereStatus(1)->orderBy('id')->with('userDataFlowLogs')->whereHas('userDataFlowLogs')->get() as $node) {
             $this->statisticsByNode($node);
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function statisticsByNode(Node $node)
     {
+        $created_at = date('Y-m-d 23:59:59', strtotime('-1 days'));
+        $time = strtotime($created_at);
         $traffic = $node->userDataFlowLogs()
-            ->whereBetween('log_time', [strtotime(date('Y-m-d')), time()])
+            ->whereBetween('log_time', [$time - 86399, $time])
             ->selectRaw('sum(`u`) as u, sum(`d`) as d')->first();
 
         if ($traffic && $total = $traffic->u + $traffic->d) { // 有数据才记录
             $node->dailyDataFlows()->create([
-                'u'       => $traffic->u,
-                'd'       => $traffic->d,
-                'total'   => $total,
-                'traffic' => flowAutoShow($total),
+                'u'          => $traffic->u,
+                'd'          => $traffic->d,
+                'total'      => $total,
+                'traffic'    => flowAutoShow($total),
+                'created_at' => $created_at,
             ]);
         }
     }

+ 11 - 9
app/Console/Commands/NodeHourlyTrafficStatistics.php

@@ -14,30 +14,32 @@ class NodeHourlyTrafficStatistics extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         foreach (Node::whereStatus(1)->orderBy('id')->with('userDataFlowLogs')->whereHas('userDataFlowLogs')->get() as $node) {
             $this->statisticsByNode($node);
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function statisticsByNode(Node $node)
     {
+        $created_at = date('Y-m-d H:59:59', strtotime('-1 hour'));
+        $time = strtotime($created_at);
         $traffic = $node->userDataFlowLogs()
-            ->whereBetween('log_time', [strtotime('-1 hour'), time()])
+            ->whereBetween('log_time', [$time - 3599, $time])
             ->selectRaw('sum(`u`) as u, sum(`d`) as d')->first();
 
         if ($traffic && $total = $traffic->u + $traffic->d) { // 有数据才记录
             $node->hourlyDataFlows()->create([
-                'u'       => $traffic->u,
-                'd'       => $traffic->d,
-                'total'   => $total,
-                'traffic' => flowAutoShow($total),
+                'u'          => $traffic->u,
+                'd'          => $traffic->d,
+                'total'      => $total,
+                'traffic'    => flowAutoShow($total),
+                'created_at' => $created_at,
             ]);
         }
     }

+ 3 - 4
app/Console/Commands/NodeStatusDetection.php

@@ -20,7 +20,7 @@ class NodeStatusDetection extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         if (sysConfig('node_offline_notification')) {// 检测节点心跳是否异常
             $this->checkNodeStatus();
@@ -34,10 +34,9 @@ class NodeStatusDetection extends Command
             }
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info("---【{$this->description}】完成---,耗时 {$jobUsedTime} 秒");
+        Log::info("---【{$this->description}】完成---,耗时 {$jobTime} 秒");
     }
 
     private function checkNodeStatus()

+ 3 - 4
app/Console/Commands/ServiceTimer.php

@@ -14,14 +14,13 @@ class ServiceTimer extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         $this->decGoodsTraffic(); // 扣减用户到期商品的流量
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     // 扣减用户到期商品的流量

+ 3 - 4
app/Console/Commands/UpdateUserSpeedLimit.php

@@ -13,15 +13,14 @@ class UpdateUserSpeedLimit extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         foreach (Order::whereStatus(2)->whereIsExpire(0)->where('goods_id', '<>', null)->oldest()->with(['user', 'goods'])->has('goods')->has('user')->get() as $order) {
             $order->user->update(['speed_limit' => $order->goods->speed_limit]);
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 }

+ 13 - 10
app/Console/Commands/UserDailyTrafficStatistics.php

@@ -13,37 +13,40 @@ class UserDailyTrafficStatistics extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
         User::activeUser()->with('dataFlowLogs')->WhereHas('dataFlowLogs')->chunk(config('tasks.chunk'), function ($users) {
             foreach ($users as $user) {
                 $this->statisticsByUser($user);
             }
         });
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function statisticsByUser(User $user)
     {
+        $created_at = date('Y-m-d 23:59:59', strtotime('-1 days'));
+        $time = strtotime($created_at);
         $logs = $user->dataFlowLogs()
-            ->whereBetween('log_time', [strtotime(date('Y-m-d')), time()])
+            ->whereBetween('log_time', [$time - 86399, $time])
             ->groupBy('node_id')
             ->selectRaw('node_id, sum(`u`) as u, sum(`d`) as d')
             ->get();
 
         if ($logs->isNotEmpty()) { // 有数据才记录
-            $data = $logs->each(function ($log) {
+            $data = $logs->each(function ($log) use ($created_at) {
                 $log->total = $log->u + $log->d;
                 $log->traffic = flowAutoShow($log->total);
+                $log->created_at = $created_at;
             })->flatten()->toArray();
 
             $data[] = [ // 每日节点流量合计
-                'u'       => $logs->sum('u'),
-                'd'       => $logs->sum('d'),
-                'total'   => $logs->sum('total'),
-                'traffic' => flowAutoShow($logs->sum('total')),
+                'u'          => $logs->sum('u'),
+                'd'          => $logs->sum('d'),
+                'total'      => $logs->sum('total'),
+                'traffic'    => flowAutoShow($logs->sum('total')),
+                'created_at' => $created_at,
             ];
 
             $user->dailyDataFlows()->createMany($data);

+ 3 - 4
app/Console/Commands/UserExpireWarning.php

@@ -14,16 +14,15 @@ class UserExpireWarning extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         if (sysConfig('account_expire_notification')) {// 用户临近到期自动提醒
             $this->userExpireWarning();
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function userExpireWarning()

+ 13 - 10
app/Console/Commands/UserHourlyTrafficMonitoring.php

@@ -17,7 +17,7 @@ class UserHourlyTrafficMonitoring extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
         $this->data_anomaly_notification = sysConfig('data_anomaly_notification');
         $this->traffic_ban_value = sysConfig('traffic_ban_value') * GB;
 
@@ -27,31 +27,34 @@ class UserHourlyTrafficMonitoring extends Command
             }
         });
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function statisticsByUser(User $user)
     {
+        $created_at = date('Y-m-d H:59:59', strtotime('-1 hour'));
+        $time = strtotime($created_at);
         $logs = $user->dataFlowLogs()
-            ->whereBetween('log_time', [strtotime('-1 hour'), time()])
+            ->whereBetween('log_time', [$time - 3599, $time])
             ->groupBy('node_id')
             ->selectRaw('node_id, sum(`u`) as u, sum(`d`) as d')
             ->get();
 
         if ($logs->isNotEmpty()) { // 有数据才记录
-            $data = $logs->each(function ($log) {
+            $data = $logs->each(function ($log) use ($created_at) {
                 $log->total = $log->u + $log->d;
                 $log->traffic = flowAutoShow($log->total);
+                $log->created_at = $created_at;
             })->flatten()->toArray();
 
             $data[] = [ // 每小时节点流量合计
-                'u'       => $logs->sum('u'),
-                'd'       => $logs->sum('d'),
-                'total'   => $logs->sum('total'),
-                'traffic' => flowAutoShow($logs->sum('total')),
+                'u'          => $logs->sum('u'),
+                'd'          => $logs->sum('d'),
+                'total'      => $logs->sum('total'),
+                'traffic'    => flowAutoShow($logs->sum('total')),
+                'created_at' => $created_at,
             ];
 
             $user->hourlyDataFlows()->createMany($data);

+ 3 - 4
app/Console/Commands/UserTrafficWarning.php

@@ -14,16 +14,15 @@ class UserTrafficWarning extends Command
 
     public function handle()
     {
-        $jobStartTime = microtime(true);
+        $jobTime = microtime(true);
 
         if (sysConfig('data_exhaust_notification')) {// 用户流量超过警告阈值提醒
             $this->userTrafficWarning();
         }
 
-        $jobEndTime = microtime(true);
-        $jobUsedTime = round(($jobEndTime - $jobStartTime), 4);
+        $jobTime = round((microtime(true) - $jobTime), 4);
 
-        Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
+        Log::info('---【'.$this->description.'】完成---,耗时'.$jobTime.'秒');
     }
 
     private function userTrafficWarning()// 用户流量超过警告阈值提醒

+ 2 - 2
app/Console/Kernel.php

@@ -57,8 +57,8 @@ class Kernel extends ConsoleKernel
         $schedule->command('dailyNodeReport')->dailyAt('09:00');
         $schedule->command('userTrafficWarning')->dailyAt('10:30');
         $schedule->command('userExpireWarning')->dailyAt('20:00');
-        $schedule->command('userDailyTrafficStatistics')->dailyAt('23:58');
-        $schedule->command('nodeDailyTrafficStatistics')->dailyAt('23:59');
+        $schedule->command('userDailyTrafficStatistics')->daily();
+        $schedule->command('nodeDailyTrafficStatistics')->daily();
     }
 
     /**

+ 190 - 94
composer.lock

@@ -70,16 +70,16 @@
         },
         {
             "name": "brick/math",
-            "version": "0.9.2",
+            "version": "0.9.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/brick/math.git",
-                "reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0"
+                "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/brick/math/zipball/dff976c2f3487d42c1db75a3b180e2b9f0e72ce0",
-                "reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0",
+                "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae",
+                "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -95,7 +95,7 @@
             "require-dev": {
                 "php-coveralls/php-coveralls": "^2.2",
                 "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0",
-                "vimeo/psalm": "4.3.2"
+                "vimeo/psalm": "4.9.2"
             },
             "type": "library",
             "autoload": {
@@ -120,15 +120,19 @@
             ],
             "support": {
                 "issues": "https://github.com/brick/math/issues",
-                "source": "https://github.com/brick/math/tree/0.9.2"
+                "source": "https://github.com/brick/math/tree/0.9.3"
             },
             "funding": [
+                {
+                    "url": "https://github.com/BenMorel",
+                    "type": "github"
+                },
                 {
                     "url": "https://tidelift.com/funding/github/packagist/brick/math",
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-01-20T22:51:39+00:00"
+            "time": "2021-08-15T20:50:18+00:00"
         },
         {
             "name": "composer/ca-bundle",
@@ -2438,16 +2442,16 @@
         },
         {
             "name": "laravel/socialite",
-            "version": "v5.2.3",
+            "version": "v5.2.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/socialite.git",
-                "reference": "1960802068f81e44b2ae9793932181cf1cb91b5c"
+                "reference": "59e2f8d9d9663029c7746a92d60bbb7697953bb9"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/socialite/zipball/1960802068f81e44b2ae9793932181cf1cb91b5c",
-                "reference": "1960802068f81e44b2ae9793932181cf1cb91b5c",
+                "url": "https://api.github.com/repos/laravel/socialite/zipball/59e2f8d9d9663029c7746a92d60bbb7697953bb9",
+                "reference": "59e2f8d9d9663029c7746a92d60bbb7697953bb9",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -2509,7 +2513,7 @@
                 "issues": "https://github.com/laravel/socialite/issues",
                 "source": "https://github.com/laravel/socialite"
             },
-            "time": "2021-04-06T14:38:16+00:00"
+            "time": "2021-08-10T17:44:52+00:00"
         },
         {
             "name": "laravel/tinker",
@@ -2769,16 +2773,16 @@
         },
         {
             "name": "league/flysystem",
-            "version": "1.1.4",
+            "version": "1.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/thephpleague/flysystem.git",
-                "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32"
+                "reference": "18634df356bfd4119fe3d6156bdb990c414c14ea"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
-                "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/18634df356bfd4119fe3d6156bdb990c414c14ea",
+                "reference": "18634df356bfd4119fe3d6156bdb990c414c14ea",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -2857,7 +2861,7 @@
             ],
             "support": {
                 "issues": "https://github.com/thephpleague/flysystem/issues",
-                "source": "https://github.com/thephpleague/flysystem/tree/1.1.4"
+                "source": "https://github.com/thephpleague/flysystem/tree/1.1.5"
             },
             "funding": [
                 {
@@ -2865,7 +2869,7 @@
                     "type": "other"
                 }
             ],
-            "time": "2021-06-23T21:56:05+00:00"
+            "time": "2021-08-17T13:49:42+00:00"
         },
         {
             "name": "league/mime-type-detection",
@@ -2931,16 +2935,16 @@
         },
         {
             "name": "league/oauth1-client",
-            "version": "v1.9.1",
+            "version": "v1.10.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/thephpleague/oauth1-client.git",
-                "reference": "19a3ce488bb1547c906209e8293199ec34eaa5b1"
+                "reference": "88dd16b0cff68eb9167bfc849707d2c40ad91ddc"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/19a3ce488bb1547c906209e8293199ec34eaa5b1",
-                "reference": "19a3ce488bb1547c906209e8293199ec34eaa5b1",
+                "url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/88dd16b0cff68eb9167bfc849707d2c40ad91ddc",
+                "reference": "88dd16b0cff68eb9167bfc849707d2c40ad91ddc",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -2953,6 +2957,7 @@
                 "ext-json": "*",
                 "ext-openssl": "*",
                 "guzzlehttp/guzzle": "^6.0|^7.0",
+                "guzzlehttp/psr7": "^1.7|^2.0",
                 "php": ">=7.1||>=8.0"
             },
             "require-dev": {
@@ -3006,9 +3011,9 @@
             ],
             "support": {
                 "issues": "https://github.com/thephpleague/oauth1-client/issues",
-                "source": "https://github.com/thephpleague/oauth1-client/tree/v1.9.1"
+                "source": "https://github.com/thephpleague/oauth1-client/tree/v1.10.0"
             },
-            "time": "2021-07-07T22:54:46+00:00"
+            "time": "2021-08-15T23:05:49+00:00"
         },
         {
             "name": "maennchen/zipstream-php",
@@ -4893,16 +4898,16 @@
         },
         {
             "name": "ramsey/collection",
-            "version": "1.1.3",
+            "version": "1.2.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/ramsey/collection.git",
-                "reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1"
+                "reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/ramsey/collection/zipball/28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1",
-                "reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1",
+                "url": "https://api.github.com/repos/ramsey/collection/zipball/eaca1dc1054ddd10cbd83c1461907bee6fb528fa",
+                "reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -4912,7 +4917,8 @@
                 ]
             },
             "require": {
-                "php": "^7.2 || ^8"
+                "php": "^7.3 || ^8",
+                "symfony/polyfill-php81": "^1.23"
             },
             "require-dev": {
                 "captainhook/captainhook": "^5.3",
@@ -4922,6 +4928,7 @@
                 "hamcrest/hamcrest-php": "^2",
                 "jangregor/phpstan-prophecy": "^0.8",
                 "mockery/mockery": "^1.3",
+                "phpspec/prophecy-phpunit": "^2.0",
                 "phpstan/extension-installer": "^1",
                 "phpstan/phpstan": "^0.12.32",
                 "phpstan/phpstan-mockery": "^0.12.5",
@@ -4949,7 +4956,7 @@
                     "homepage": "https://benramsey.com"
                 }
             ],
-            "description": "A PHP 7.2+ library for representing and manipulating collections.",
+            "description": "A PHP library for representing and manipulating collections.",
             "keywords": [
                 "array",
                 "collection",
@@ -4960,7 +4967,7 @@
             ],
             "support": {
                 "issues": "https://github.com/ramsey/collection/issues",
-                "source": "https://github.com/ramsey/collection/tree/1.1.3"
+                "source": "https://github.com/ramsey/collection/tree/1.2.1"
             },
             "funding": [
                 {
@@ -4972,20 +4979,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-01-21T17:40:04+00:00"
+            "time": "2021-08-06T03:41:06+00:00"
         },
         {
             "name": "ramsey/uuid",
-            "version": "4.1.1",
+            "version": "4.2.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/ramsey/uuid.git",
-                "reference": "cd4032040a750077205918c86049aa0f43d22947"
+                "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/ramsey/uuid/zipball/cd4032040a750077205918c86049aa0f43d22947",
-                "reference": "cd4032040a750077205918c86049aa0f43d22947",
+                "url": "https://api.github.com/repos/ramsey/uuid/zipball/fe665a03df4f056aa65af552a96e1976df8c8dae",
+                "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -5005,26 +5012,26 @@
                 "rhumsaa/uuid": "self.version"
             },
             "require-dev": {
-                "codeception/aspect-mock": "^3",
-                "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0",
+                "captainhook/captainhook": "^5.10",
+                "captainhook/plugin-composer": "^5.3",
+                "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
                 "doctrine/annotations": "^1.8",
-                "goaop/framework": "^2",
+                "ergebnis/composer-normalize": "^2.15",
                 "mockery/mockery": "^1.3",
                 "moontoast/math": "^1.1",
                 "paragonie/random-lib": "^2",
+                "php-mock/php-mock": "^2.2",
                 "php-mock/php-mock-mockery": "^1.3",
-                "php-mock/php-mock-phpunit": "^2.5",
                 "php-parallel-lint/php-parallel-lint": "^1.1",
-                "phpbench/phpbench": "^0.17.1",
+                "phpbench/phpbench": "^1.0",
                 "phpstan/extension-installer": "^1.0",
                 "phpstan/phpstan": "^0.12",
                 "phpstan/phpstan-mockery": "^0.12",
                 "phpstan/phpstan-phpunit": "^0.12",
-                "phpunit/phpunit": "^8.5",
-                "psy/psysh": "^0.10.0",
-                "slevomat/coding-standard": "^6.0",
+                "phpunit/phpunit": "^8.5 || ^9",
+                "slevomat/coding-standard": "^7.0",
                 "squizlabs/php_codesniffer": "^3.5",
-                "vimeo/psalm": "3.9.4"
+                "vimeo/psalm": "^4.9"
             },
             "suggest": {
                 "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.",
@@ -5037,7 +5044,10 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "4.x-dev"
+                    "dev-main": "4.x-dev"
+                },
+                "captainhook": {
+                    "force-install": true
                 }
             },
             "autoload": {
@@ -5053,7 +5063,6 @@
                 "MIT"
             ],
             "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).",
-            "homepage": "https://github.com/ramsey/uuid",
             "keywords": [
                 "guid",
                 "identifier",
@@ -5061,16 +5070,19 @@
             ],
             "support": {
                 "issues": "https://github.com/ramsey/uuid/issues",
-                "rss": "https://github.com/ramsey/uuid/releases.atom",
-                "source": "https://github.com/ramsey/uuid"
+                "source": "https://github.com/ramsey/uuid/tree/4.2.1"
             },
             "funding": [
                 {
                     "url": "https://github.com/ramsey",
                     "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid",
+                    "type": "tidelift"
                 }
             ],
-            "time": "2020-08-18T17:17:46+00:00"
+            "time": "2021-08-11T01:06:55+00:00"
         },
         {
             "name": "rap2hpoutre/laravel-log-viewer",
@@ -5336,16 +5348,16 @@
         },
         {
             "name": "spatie/laravel-permission",
-            "version": "4.2.0",
+            "version": "4.3.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/spatie/laravel-permission.git",
-                "reference": "a6e4122b65094baba7f98df153af0768ef910c85"
+                "reference": "78eaa5e06c313a9f3672a7571b4d83b913721b72"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/a6e4122b65094baba7f98df153af0768ef910c85",
-                "reference": "a6e4122b65094baba7f98df153af0768ef910c85",
+                "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/78eaa5e06c313a9f3672a7571b4d83b913721b72",
+                "reference": "78eaa5e06c313a9f3672a7571b4d83b913721b72",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -5408,7 +5420,7 @@
             ],
             "support": {
                 "issues": "https://github.com/spatie/laravel-permission/issues",
-                "source": "https://github.com/spatie/laravel-permission/tree/4.2.0"
+                "source": "https://github.com/spatie/laravel-permission/tree/4.3.0"
             },
             "funding": [
                 {
@@ -5416,7 +5428,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2021-06-04T23:47:08+00:00"
+            "time": "2021-08-17T18:37:17+00:00"
         },
         {
             "name": "srmklive/paypal",
@@ -5485,16 +5497,16 @@
         },
         {
             "name": "stripe/stripe-php",
-            "version": "v7.92.0",
+            "version": "v7.93.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/stripe/stripe-php.git",
-                "reference": "4b549e6f7d3e7ffd877547a0f1e8bd01c363e268"
+                "reference": "c739cf6841bb3498e23bd52ecfadfcb21c521a14"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/4b549e6f7d3e7ffd877547a0f1e8bd01c363e268",
-                "reference": "4b549e6f7d3e7ffd877547a0f1e8bd01c363e268",
+                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/c739cf6841bb3498e23bd52ecfadfcb21c521a14",
+                "reference": "c739cf6841bb3498e23bd52ecfadfcb21c521a14",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -5546,9 +5558,9 @@
             ],
             "support": {
                 "issues": "https://github.com/stripe/stripe-php/issues",
-                "source": "https://github.com/stripe/stripe-php/tree/v7.92.0"
+                "source": "https://github.com/stripe/stripe-php/tree/v7.93.0"
             },
-            "time": "2021-07-28T17:38:57+00:00"
+            "time": "2021-08-11T18:48:54+00:00"
         },
         {
             "name": "swiftmailer/swiftmailer",
@@ -7426,6 +7438,91 @@
             ],
             "time": "2021-07-28T13:41:28+00:00"
         },
+        {
+            "name": "symfony/polyfill-php81",
+            "version": "v1.23.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-php81.git",
+                "reference": "e66119f3de95efc359483f810c4c3e6436279436"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436",
+                "reference": "e66119f3de95efc359483f810c4c3e6436279436",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=7.1"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-main": "1.23-dev"
+                },
+                "thanks": {
+                    "name": "symfony/polyfill",
+                    "url": "https://github.com/symfony/polyfill"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Polyfill\\Php81\\": ""
+                },
+                "files": [
+                    "bootstrap.php"
+                ],
+                "classmap": [
+                    "Resources/stubs"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Nicolas Grekas",
+                    "email": "[email protected]"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "compatibility",
+                "polyfill",
+                "portable",
+                "shim"
+            ],
+            "support": {
+                "source": "https://github.com/symfony/polyfill-php81/tree/v1.23.0"
+            },
+            "funding": [
+                {
+                    "url": "https://symfony.com/sponsor",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2021-05-21T13:25:03+00:00"
+        },
         {
             "name": "symfony/process",
             "version": "v5.3.4",
@@ -9528,16 +9625,16 @@
         },
         {
             "name": "composer/xdebug-handler",
-            "version": "2.0.1",
+            "version": "2.0.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/xdebug-handler.git",
-                "reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496"
+                "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/964adcdd3a28bf9ed5d9ac6450064e0d71ed7496",
-                "reference": "964adcdd3a28bf9ed5d9ac6450064e0d71ed7496",
+                "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339",
+                "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -9548,7 +9645,7 @@
             },
             "require": {
                 "php": "^5.3.2 || ^7.0 || ^8.0",
-                "psr/log": "^1.0"
+                "psr/log": "^1 || ^2 || ^3"
             },
             "require-dev": {
                 "phpstan/phpstan": "^0.12.55",
@@ -9578,7 +9675,7 @@
             "support": {
                 "irc": "irc://irc.freenode.org/composer",
                 "issues": "https://github.com/composer/xdebug-handler/issues",
-                "source": "https://github.com/composer/xdebug-handler/tree/2.0.1"
+                "source": "https://github.com/composer/xdebug-handler/tree/2.0.2"
             },
             "funding": [
                 {
@@ -9594,7 +9691,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-05-05T19:37:51+00:00"
+            "time": "2021-07-31T17:03:58+00:00"
         },
         {
             "name": "doctrine/instantiator",
@@ -9744,16 +9841,16 @@
         },
         {
             "name": "facade/ignition",
-            "version": "2.11.2",
+            "version": "2.11.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/facade/ignition.git",
-                "reference": "7c4e7a7da184cd00c7ce6eacc590200bb9672de7"
+                "reference": "1b8d83c5dac7c5ee8429daf284ce3f19b1d17ea2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/facade/ignition/zipball/7c4e7a7da184cd00c7ce6eacc590200bb9672de7",
-                "reference": "7c4e7a7da184cd00c7ce6eacc590200bb9672de7",
+                "url": "https://api.github.com/repos/facade/ignition/zipball/1b8d83c5dac7c5ee8429daf284ce3f19b1d17ea2",
+                "reference": "1b8d83c5dac7c5ee8429daf284ce3f19b1d17ea2",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -9822,7 +9919,7 @@
                 "issues": "https://github.com/facade/ignition/issues",
                 "source": "https://github.com/facade/ignition"
             },
-            "time": "2021-07-20T14:01:22+00:00"
+            "time": "2021-08-17T11:45:33+00:00"
         },
         {
             "name": "facade/ignition-contracts",
@@ -10239,16 +10336,16 @@
         },
         {
             "name": "maximebf/debugbar",
-            "version": "v1.17.0",
+            "version": "v1.17.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/maximebf/php-debugbar.git",
-                "reference": "4ef8e359d9fffbfbce26218ee36f196453a4dd7d"
+                "reference": "0a3532556be0145603f8a9de23e76dc28eed7054"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/4ef8e359d9fffbfbce26218ee36f196453a4dd7d",
-                "reference": "4ef8e359d9fffbfbce26218ee36f196453a4dd7d",
+                "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/0a3532556be0145603f8a9de23e76dc28eed7054",
+                "reference": "0a3532556be0145603f8a9de23e76dc28eed7054",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -10304,9 +10401,9 @@
             ],
             "support": {
                 "issues": "https://github.com/maximebf/php-debugbar/issues",
-                "source": "https://github.com/maximebf/php-debugbar/tree/v1.17.0"
+                "source": "https://github.com/maximebf/php-debugbar/tree/v1.17.1"
             },
-            "time": "2021-07-27T05:47:57+00:00"
+            "time": "2021-08-01T09:19:02+00:00"
         },
         {
             "name": "mockery/mockery",
@@ -11103,16 +11200,16 @@
         },
         {
             "name": "phpseclib/phpseclib",
-            "version": "3.0.9",
+            "version": "3.0.10",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpseclib/phpseclib.git",
-                "reference": "a127a5133804ff2f47ae629dd529b129da616ad7"
+                "reference": "62fcc5a94ac83b1506f52d7558d828617fac9187"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/a127a5133804ff2f47ae629dd529b129da616ad7",
-                "reference": "a127a5133804ff2f47ae629dd529b129da616ad7",
+                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/62fcc5a94ac83b1506f52d7558d828617fac9187",
+                "reference": "62fcc5a94ac83b1506f52d7558d828617fac9187",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -11200,7 +11297,7 @@
             ],
             "support": {
                 "issues": "https://github.com/phpseclib/phpseclib/issues",
-                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.9"
+                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.10"
             },
             "funding": [
                 {
@@ -11216,7 +11313,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2021-06-14T06:54:45+00:00"
+            "time": "2021-08-16T04:24:45+00:00"
         },
         {
             "name": "phpspec/prophecy",
@@ -11641,16 +11738,16 @@
         },
         {
             "name": "phpunit/phpunit",
-            "version": "9.5.7",
+            "version": "9.5.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5"
+                "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5",
-                "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb",
+                "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -11668,7 +11765,7 @@
                 "ext-xml": "*",
                 "ext-xmlwriter": "*",
                 "myclabs/deep-copy": "^1.10.1",
-                "phar-io/manifest": "^2.0.1",
+                "phar-io/manifest": "^2.0.3",
                 "phar-io/version": "^3.0.2",
                 "php": ">=7.3",
                 "phpspec/prophecy": "^1.12.1",
@@ -11734,7 +11831,7 @@
             ],
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.7"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8"
             },
             "funding": [
                 {
@@ -11746,7 +11843,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2021-07-19T06:14:47+00:00"
+            "time": "2021-07-31T15:17:34+00:00"
         },
         {
             "name": "react/promise",
@@ -12741,7 +12838,6 @@
                     "type": "github"
                 }
             ],
-            "abandoned": true,
             "time": "2020-09-28T06:45:17+00:00"
         },
         {

+ 1 - 1
config/tasks.php

@@ -14,7 +14,7 @@ return [
         'user_baned_logs'       => '-3 month', // 清除用户封禁日志
         'user_daily_logs_nodes' => '-1 month', // 清除用户各节点的每天流量数据日志
         'user_daily_logs_total' => '-3 month', // 清除用户节点总计的每天流量数据日志
-        'user_hourly_logs'      => '-3 days', // 清除用户每时各流量数据日志
+        'user_hourly_logs'      => '-3 days', // 清除用户每时各流量数据日志 最少值为 2
         'login_logs'            => '-3 month', // 清除用户登陆日志
         'subscribe_logs'        => '-1 month', // 清理用户订阅请求日志
         'traffic_logs'          => '-3 days', // 清除用户流量日志

+ 4 - 0
resources/views/admin/node/info.blade.php

@@ -477,6 +477,10 @@
                     $('#v2_tls').click();
                     @endif
                     $('#tls_provider').val('{!! $node->tls_provider !!}');
+                    break;
+                case 3:
+                    $('#trojan_port').val('{{$node->port}}');
+                    break;
                 default:
             }