admin 7 лет назад
Родитель
Сommit
9a2800d342
2 измененных файлов с 21 добавлено и 0 удалено
  1. 19 0
      app/helpers.php
  2. 2 0
      resources/views/admin/nodeList.blade.php

+ 19 - 0
app/helpers.php

@@ -102,6 +102,25 @@ if (!function_exists('formatBytes')) {
     }
 }
 
+// 秒转时间
+if (!function_exists('seconds2time')) {
+    function seconds2time($seconds)
+    {
+        $day = floor($seconds / (3600 * 24));
+        $hour = floor(($seconds % (3600 * 24)) / 3600);
+        $minute = floor((($seconds % (3600 * 24)) % 3600) / 60);
+        if ($day > 0) {
+            echo $day . '天' . $hour . '小时' . $minute . '分';
+        } else {
+            if ($hour != 0) {
+                echo $hour . '小时' . $minute . '分';
+            } else {
+                echo $minute . '分';
+            }
+        }
+    }
+}
+
 // 获取访客真实IP
 if (!function_exists('getClientIP')) {
     function getClientIP()

+ 2 - 0
resources/views/admin/nodeList.blade.php

@@ -40,6 +40,7 @@
                                     <th> 名称 </th>
                                     <th> IP </th>
                                     <th> 域名 </th>
+                                    <th> 存活 </th>
                                     <th> 状态 </th>
                                     <th> 在线 </th>
                                     <th> <span class="node-flow"><a href="javascript:showFlowTips();">产生流量</a></span> </th>
@@ -69,6 +70,7 @@
                                                     @endif
                                                 </td>
                                                 <td> <span class="label {{$node->status ? 'label-danger' : 'label-default'}}">{{$node->server}}</span> </td>
+                                                <td> <span class="label {{$node->status ? 'label-danger' : 'label-default'}}">{{seconds2time($node->uptime)}}</span> </td>
                                                 <td> <span class="label {{$node->status ? 'label-danger' : 'label-default'}}">{{$node->load}}</span> </td>
                                                 <td> <span class="label {{$node->status ? 'label-danger' : 'label-default'}}">{{$node->online_users}}</span> </td>
                                                 <td> {{$node->transfer}} </td>