现在不需要在监控页面调用后端查询服务和设备关系了
This commit is contained in:
@@ -323,12 +323,6 @@ $worker -> onMessage = function(TcpConnection $connection, Request $request) {
|
|||||||
'code' => 0,
|
'code' => 0,
|
||||||
'data' => $devices
|
'data' => $devices
|
||||||
)));
|
)));
|
||||||
} else if ($get['query'] === 'all_devices') {
|
|
||||||
$all_devices = EConfigure::get_all_devices($dbconn);
|
|
||||||
$connection -> send(json_encode(array(
|
|
||||||
'code' => 0,
|
|
||||||
'data' => $all_devices
|
|
||||||
)));
|
|
||||||
} else {
|
} else {
|
||||||
$connection -> send(json_encode(array(
|
$connection -> send(json_encode(array(
|
||||||
'code' => 1,
|
'code' => 1,
|
||||||
|
|||||||
@@ -162,28 +162,4 @@ class EConfigure {
|
|||||||
));
|
));
|
||||||
return pg_fetch_all($res);
|
return pg_fetch_all($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function get_all_devices() {
|
|
||||||
$res = pg_query(
|
|
||||||
"SELECT server_id,
|
|
||||||
server.name AS server_name,
|
|
||||||
url, port,
|
|
||||||
device.name AS device_name,
|
|
||||||
conf -> '@DeviceType' AS device_type
|
|
||||||
FROM hf_mes_scada_edgeserver_controller_server server,
|
|
||||||
hf_mes_scada_edgeserver_controller_device device
|
|
||||||
WHERE (conf -> '@DeviceType') IS NOT NULL
|
|
||||||
AND server.id = server_id;"
|
|
||||||
);
|
|
||||||
$server_devices = pg_fetch_all($res);
|
|
||||||
|
|
||||||
$all_devices = [];
|
|
||||||
foreach ($server_devices as $device) {
|
|
||||||
if (!isset($all_devices[$device['server_id']]))
|
|
||||||
$all_devices[$device['server_id']] = array_slice($device, 0, 4);
|
|
||||||
$all_devices[$device['server_id']]['devices'][] = array_slice($device, -2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $all_devices;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user