信息采集接口

This commit is contained in:
chenbo 2024-01-29 10:06:15 +08:00
parent a9730932e8
commit fbababf4dc
1 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,9 @@ class RemoteRequestLogic extends BaseLogic
$datas['ambient_temperature'] = 0; $datas['ambient_temperature'] = 0;
$datas['ambient_humidity'] = 0; $datas['ambient_humidity'] = 0;
} }
} else {
$datas['ambient_temperature'] = 0;
$datas['ambient_humidity'] = 0;
} }
// 氮气 nitrogen // 氮气 nitrogen
@ -32,6 +35,8 @@ class RemoteRequestLogic extends BaseLogic
$NMonitor = self::requestMqtt($NDevice); $NMonitor = self::requestMqtt($NDevice);
if (!empty($NMonitor)) { if (!empty($NMonitor)) {
$datas['nitrogen'] = $NMonitor[1][2]; $datas['nitrogen'] = $NMonitor[1][2];
}else {
$datas['nitrogen'] = 0;
} }
} else { } else {
$datas['nitrogen'] = 0; $datas['nitrogen'] = 0;
@ -43,6 +48,8 @@ class RemoteRequestLogic extends BaseLogic
$fireproofMonitor = self::requestMqtt($fireproofDevice); $fireproofMonitor = self::requestMqtt($fireproofDevice);
if (!empty($fireproofMonitor)) { if (!empty($fireproofMonitor)) {
$datas['fireproof'] = $fireproofMonitor[1][2]; $datas['fireproof'] = $fireproofMonitor[1][2];
} else {
$datas['fireproof'] = 0;
} }
} else { } else {
$datas['fireproof'] = 0; $datas['fireproof'] = 0;
@ -54,7 +61,10 @@ class RemoteRequestLogic extends BaseLogic
$methaneMonitor = self::requestMqtt($methaneDevice); $methaneMonitor = self::requestMqtt($methaneDevice);
if (!empty($methaneMonitor)) { if (!empty($methaneMonitor)) {
$datas['methane'] = $methaneMonitor[1][2]; $datas['methane'] = $methaneMonitor[1][2];
} else {
$datas['methane'] = 0;
} }
} else { } else {
$datas['methane'] = 0; $datas['methane'] = 0;
} }
@ -65,6 +75,8 @@ class RemoteRequestLogic extends BaseLogic
$noiseMonitor = self::requestMqtt($noiseDevice); $noiseMonitor = self::requestMqtt($noiseDevice);
if (!empty($noiseMonitor)) { if (!empty($noiseMonitor)) {
$datas['noise'] = $noiseMonitor[1][2]; $datas['noise'] = $noiseMonitor[1][2];
} else {
$datas['noise'] = 0;
} }
} else { } else {
$datas['noise'] = 0; $datas['noise'] = 0;