diff --git a/app/admin/controller/system/Host.php b/app/admin/controller/system/Host.php
new file mode 100644
index 0000000..33fcf47
--- /dev/null
+++ b/app/admin/controller/system/Host.php
@@ -0,0 +1,13 @@
+model = new \app\admin\model\SystemHost();
+
+ $this->assign('select_list_status', $this->model::SELECT_LIST_STATUS, true);
+ }
+}
diff --git a/extend/base/admin/model/SystemHostBase.php b/extend/base/admin/model/SystemHostBase.php
new file mode 100644
index 0000000..4cc7a36
--- /dev/null
+++ b/extend/base/admin/model/SystemHostBase.php
@@ -0,0 +1,28 @@
+ '离线', '1' => '在线'];
+}
diff --git a/extend/base/admin/view/system/host/_common.js b/extend/base/admin/view/system/host/_common.js
new file mode 100644
index 0000000..ad6eb5d
--- /dev/null
+++ b/extend/base/admin/view/system/host/_common.js
@@ -0,0 +1,10 @@
+var init = {
+ tableElem: '#currentTable',
+ tableRenderId: 'currentTableRenderId',
+ indexUrl: 'system.host/index',
+ addUrl: 'system.host/add' + location.search,
+ editUrl: 'system.host/edit',
+ deleteUrl: 'system.host/delete',
+ exportUrl: 'system.host/export',
+ modifyUrl: 'system.host/modify',
+};
\ No newline at end of file
diff --git a/extend/base/admin/view/system/host/add.html b/extend/base/admin/view/system/host/add.html
new file mode 100644
index 0000000..3264b44
--- /dev/null
+++ b/extend/base/admin/view/system/host/add.html
@@ -0,0 +1,77 @@
+
\ No newline at end of file
diff --git a/extend/base/admin/view/system/host/add.js b/extend/base/admin/view/system/host/add.js
new file mode 100644
index 0000000..4a445e0
--- /dev/null
+++ b/extend/base/admin/view/system/host/add.js
@@ -0,0 +1,3 @@
+$(function(){
+ ua.listen();
+})
\ No newline at end of file
diff --git a/extend/base/admin/view/system/host/edit.html b/extend/base/admin/view/system/host/edit.html
new file mode 100644
index 0000000..1d59661
--- /dev/null
+++ b/extend/base/admin/view/system/host/edit.html
@@ -0,0 +1,77 @@
+
\ No newline at end of file
diff --git a/extend/base/admin/view/system/host/edit.js b/extend/base/admin/view/system/host/edit.js
new file mode 100644
index 0000000..4a445e0
--- /dev/null
+++ b/extend/base/admin/view/system/host/edit.js
@@ -0,0 +1,3 @@
+$(function(){
+ ua.listen();
+})
\ No newline at end of file
diff --git a/extend/base/admin/view/system/host/index.html b/extend/base/admin/view/system/host/index.html
new file mode 100644
index 0000000..083bdc6
--- /dev/null
+++ b/extend/base/admin/view/system/host/index.html
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/extend/base/admin/view/system/host/index.js b/extend/base/admin/view/system/host/index.js
new file mode 100644
index 0000000..21b3c53
--- /dev/null
+++ b/extend/base/admin/view/system/host/index.js
@@ -0,0 +1,10 @@
+$(function(){
+ ua.table.render({
+ init: init,
+ cols: [[
+ {type: 'checkbox'},
{field: 'id', title: 'ID'},
{field: 'node_id', title: '节点ID'},
{field: 'ip_address', title: 'IP地址'},
{field: 'status', search: 'select', selectList: ua.getDataBrage('select_list_status'), title: '状态', templet: ua.table.switch},
{field: 'last_heartbeat_at', title: '最后心跳时间'},
{field: 'os_info', title: '系统信息'},
{field: 'php_version', title: 'PHP版本'},
{field: 'cpu_load', title: 'CPU负载'},
{field: 'memory_usage', title: '内存占用'},
{field: 'disk_free', title: '磁盘可用空间'},
{field: 'disk_total', title: '磁盘总空间'},
{field: 'create_time', title: '首次运行时间'},
{width: 250, title: '操作', templet: ua.table.tool , fixed:'right'},
+ ]],
+ });
+
+ ua.listen();
+})
\ No newline at end of file
diff --git a/extend/base/common/service/HostServiceBase.php b/extend/base/common/service/HostServiceBase.php
index 9bf4fd9..9215705 100644
--- a/extend/base/common/service/HostServiceBase.php
+++ b/extend/base/common/service/HostServiceBase.php
@@ -1,4 +1,3 @@
-
round($l, 2), $load)) : null;
+ $cpuLoad = is_array($load) ? implode(',', array_map(fn ($l) => round($l, 2), $load)) : null;
}
return [
- 'status' => 1,
- 'last_heartbeat_at' => date('Y-m-d H:i:s'),
- 'ip_address' => gethostbyname(gethostname()),
- 'cpu_load' => $cpuLoad,
- 'memory_usage' => memory_get_usage(), // false: 获取脚本自身内存占用
- 'disk_free' => disk_free_space(App::getRootPath()),
- 'disk_total' => disk_total_space(App::getRootPath()),
+ 'status' => 1,
+ 'last_heartbeat_at' => date('Y-m-d H:i:s'),
+ 'ip_address' => gethostbyname(gethostname()),
+ 'cpu_load' => $cpuLoad,
+ 'memory_usage' => memory_get_usage(), // false: 获取脚本自身内存占用
+ 'disk_free' => disk_free_space(App::getRootPath()),
+ 'disk_total' => disk_total_space(App::getRootPath()),
];
}
/**
- * 收集主机的静态信息 (仅在首次注册时调用)
+ * 收集主机的静态信息 (仅在首次注册时调用).
* @return array
*/
public static function collectStaticInfo(): array
{
return [
- 'os_info' => php_uname(),
- 'php_version' => PHP_VERSION,
+ 'os_info' => php_uname(),
+ 'php_version' => PHP_VERSION,
];
}
}