更新首页接口
This commit is contained in:
parent
6be8667105
commit
129a96b082
|
@ -46,24 +46,24 @@ class IndexController extends BaseApiController
|
||||||
//获取监测数据
|
//获取监测数据
|
||||||
$landDeviceForSoil = LandDevice::where('land_id',$land['id'])->where('device_type',1)->findOrEmpty();
|
$landDeviceForSoil = LandDevice::where('land_id',$land['id'])->where('device_type',1)->findOrEmpty();
|
||||||
if($landDeviceForSoil->isEmpty()){
|
if($landDeviceForSoil->isEmpty()){
|
||||||
$data['soil_device'] = 0;
|
$land['soil_device'] = 0;
|
||||||
}else{
|
}else{
|
||||||
$data['soil_device'] = 1;
|
$land['soil_device'] = 1;
|
||||||
$data['soil_monitor_data'] = SoilMonitor::where('device_id',$landDeviceForSoil['device_id'])->order('id desc')->findOrEmpty();
|
$land['soil_monitor_data'] = SoilMonitor::where('device_id',$landDeviceForSoil['device_id'])->order('id desc')->findOrEmpty();
|
||||||
}
|
}
|
||||||
$landDeviceForAir = LandDevice::where('land_id',$land['id'])->where('device_type',2)->findOrEmpty();
|
$landDeviceForAir = LandDevice::where('land_id',$land['id'])->where('device_type',2)->findOrEmpty();
|
||||||
if($landDeviceForAir->isEmpty()){
|
if($landDeviceForAir->isEmpty()){
|
||||||
$data['air_device'] = 0;
|
$land['air_device'] = 0;
|
||||||
}else{
|
}else{
|
||||||
$data['air_device'] = 1;
|
$land['air_device'] = 1;
|
||||||
$data['air_monitor_data'] = AirMonitor::where('device_id',$landDeviceForAir['device_id'])->order('id desc')->findOrEmpty();
|
$land['air_monitor_data'] = AirMonitor::where('device_id',$landDeviceForAir['device_id'])->order('id desc')->findOrEmpty();
|
||||||
}
|
}
|
||||||
$landDeviceForVideo = LandDevice::where('land_id',$land['id'])->where('device_type',3)->findOrEmpty();
|
$landDeviceForVideo = LandDevice::where('land_id',$land['id'])->where('device_type',3)->findOrEmpty();
|
||||||
if($landDeviceForVideo->isEmpty()){
|
if($landDeviceForVideo->isEmpty()){
|
||||||
$data['video_device'] = 0;
|
$land['video_device'] = 0;
|
||||||
}else{
|
}else{
|
||||||
$data['video_device'] = 1;
|
$land['video_device'] = 1;
|
||||||
$data['video_monitor_data'] = '';
|
$land['video_monitor_data'] = '';
|
||||||
}
|
}
|
||||||
return $this->success('请求成功',$land->toArray());
|
return $this->success('请求成功',$land->toArray());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue