更新 app/api/controller/IndexController.php

修复数组判断
This commit is contained in:
mkm 2023-12-20 18:04:50 +08:00
parent 8f1b8ad26a
commit 8bf95a9a21
1 changed files with 171 additions and 166 deletions

View File

@ -69,7 +69,12 @@ class IndexController extends BaseApiController
'light_intensity'=>$landCollection['ambient_lighting'],
'create_time' => $landCollection['create_time']
];
$monitorThreshold = MonitorThreshold::select()->toArray()[0];
$monitorThreshold = MonitorThreshold::select();
if($monitorThreshold){
$monitorThreshold=$monitorThreshold->toArray()[0]
}else{
$monitorThreshold=[];
}
$monitorThreshold['ambient_air_pressure_max'] = 120;
$monitorThreshold['ambient_air_pressure_min'] = 10;
$data['monitor']['threshold'] = $monitorThreshold;