bingo 7 rokov pred
rodič
commit
5c8a78a76a

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

@@ -23,6 +23,8 @@ class AutoClearLog extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $config = $this->systemConfig();
 
         if ($config['is_clear_log']) {
@@ -42,7 +44,10 @@ class AutoClearLog extends Command
             SsNodeTrafficHourly::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-60 days')))->delete();
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     // 系统配置

+ 6 - 1
app/Console/Commands/AutoDecGoodsTraffic.php

@@ -23,6 +23,8 @@ class AutoDecGoodsTraffic extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $orderList = Order::query()->with(['user', 'goods'])->where('status', 2)->where('is_expire', 0)->where('expire_at', '>=', date('Y-m-d H:i:s'))->get();
         if (!$orderList->isEmpty()) {
             $config = $this->systemConfig();
@@ -70,7 +72,10 @@ class AutoDecGoodsTraffic extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     // 系统配置

+ 7 - 2
app/Console/Commands/AutoJob.php

@@ -40,6 +40,8 @@ class AutoJob extends Command
      */
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $config = $this->systemConfig();
 
         // 优惠券到期自动置无效
@@ -167,7 +169,7 @@ class AutoJob extends Command
 
         // 被封禁账号自动释放端口
         if ($config['auto_release_port']) {
-            $userList = User::query()->where('enabled', 0)->where('ban_time', -1)->get();
+            $userList = User::query()->where('enable', 0)->where('ban_time', -1)->get();
             if (!$userList->isEmpty()) {
                 foreach ($userList as $user) {
                     if ($user->port) {
@@ -238,7 +240,10 @@ class AutoJob extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     // 添加用户封禁日志

+ 6 - 1
app/Console/Commands/AutoResetUserTraffic.php

@@ -20,6 +20,8 @@ class AutoResetUserTraffic extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $config = $this->systemConfig();
 
         if ($config['reset_traffic']) {
@@ -58,7 +60,10 @@ class AutoResetUserTraffic extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     // 系统配置

+ 6 - 1
app/Console/Commands/AutoStatisticsNodeDailyTraffic.php

@@ -20,12 +20,17 @@ class AutoStatisticsNodeDailyTraffic extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $nodeList = SsNode::query()->where('status', 1)->orderBy('id', 'asc')->get();
         foreach ($nodeList as $node) {
             $this->statisticsByNode($node->id);
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     private function statisticsByNode($node_id)

+ 6 - 1
app/Console/Commands/AutoStatisticsNodeHourlyTraffic.php

@@ -20,12 +20,17 @@ class AutoStatisticsNodeHourlyTraffic extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $nodeList = SsNode::query()->where('status', 1)->orderBy('id', 'asc')->get();
         foreach ($nodeList as $node) {
             $this->statisticsByNode($node->id);
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     private function statisticsByNode($node_id)

+ 6 - 1
app/Console/Commands/AutoStatisticsUserDailyTraffic.php

@@ -21,6 +21,8 @@ class AutoStatisticsUserDailyTraffic extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $userList = User::query()->where('status', '>=', 0)->where('enable', 1)->get();
         foreach ($userList as $user) {
             // 统计一次所有节点的总和
@@ -33,7 +35,10 @@ class AutoStatisticsUserDailyTraffic extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     private function statisticsByNode($user_id, $node_id = 0)

+ 6 - 1
app/Console/Commands/AutoStatisticsUserHourlyTraffic.php

@@ -21,6 +21,8 @@ class AutoStatisticsUserHourlyTraffic extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $userList = User::query()->where('status', '>=', 0)->where('enable', 1)->get();
         foreach ($userList as $user) {
             // 统计一次所有节点的总和
@@ -33,7 +35,10 @@ class AutoStatisticsUserHourlyTraffic extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     private function statisticsByNode($user_id, $node_id = 0)

+ 6 - 1
app/Console/Commands/UserExpireAutoWarning.php

@@ -24,6 +24,8 @@ class UserExpireAutoWarning extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $config = $this->systemConfig();
 
         if ($config['expire_warning']) {
@@ -49,7 +51,10 @@ class UserExpireAutoWarning extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     /**

+ 6 - 1
app/Console/Commands/UserTrafficAbnormalAutoWarning.php

@@ -22,6 +22,8 @@ class UserTrafficAbnormalAutoWarning extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $config = $this->systemConfig();
 
         // 24小时内流量异常用户
@@ -53,7 +55,10 @@ class UserTrafficAbnormalAutoWarning extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     // 系统配置

+ 6 - 1
app/Console/Commands/UserTrafficAutoWarning.php

@@ -24,6 +24,8 @@ class UserTrafficAutoWarning extends Command
 
     public function handle()
     {
+        $jobStartTime = microtime(true);
+
         $config = $this->systemConfig();
 
         if ($config['traffic_warning']) {
@@ -49,7 +51,10 @@ class UserTrafficAutoWarning extends Command
             }
         }
 
-        Log::info('定时任务:' . $this->description);
+        $jobEndTime = microtime(true);
+        $jobUsedTime = round(($jobEndTime - $jobStartTime) , 4);
+
+        Log::info('定时任务【' . $this->description . '】耗时' . $jobUsedTime . '秒');
     }
 
     /**