Merge pull request 'update' (#23) from zhangwei into dev

Reviewed-on: #23
This commit is contained in:
weiz 2023-11-28 10:32:53 +08:00
commit 73182f382c
1 changed files with 8 additions and 3 deletions

View File

@ -7,6 +7,7 @@ use app\common\model\land\Land;
use app\common\model\land\LandProduct; use app\common\model\land\LandProduct;
use app\common\model\monitor\MonitorData; use app\common\model\monitor\MonitorData;
use app\common\model\plant\Plant; use app\common\model\plant\Plant;
use app\common\model\product\ProductDevice;
use think\facade\Log; use think\facade\Log;
use think\response\Json; use think\response\Json;
@ -65,6 +66,12 @@ class IndexController extends BaseApiController
'create_time' => $monitor['create_time'] 'create_time' => $monitor['create_time']
]; ];
} }
$device = ProductDevice::where('product_id',$landProduct['product_id'])->where('device_type',3)->findOrEmpty();
// if($device->isEmpty()){
// $data['monitor']['video_monitor_data'] = '';
// }else{
// $data['monitor']['video_monitor_data'] = '';
// }
} }
return $this->success('请求成功',$data); return $this->success('请求成功',$data);
} }
@ -124,13 +131,11 @@ class IndexController extends BaseApiController
$plantInfo['land_area'] = $landInfo['total_area']; $plantInfo['land_area'] = $landInfo['total_area'];
$plantInfo['land_address'] = $landInfo['province_name'].$landInfo['city_name'].$landInfo['county_name'].$landInfo['town_name'].$landInfo['village_name'].$landInfo['group_name']; $plantInfo['land_address'] = $landInfo['province_name'].$landInfo['city_name'].$landInfo['county_name'].$landInfo['town_name'].$landInfo['village_name'].$landInfo['group_name'];
//获取操作 //获取操作
$action = Action::field('type_text,detail,create_time')->where('plant_id',$params['plant_id'])->select()->each(function($item){ $action = Action::field('type,type_text,detail,create_time')->where('plant_id',$params['plant_id'])->select()->each(function($item){
$item['detail'] = json_decode($item['detail'],true); $item['detail'] = json_decode($item['detail'],true);
return $item; return $item;
})->toArray(); })->toArray();
$plantInfo['actions'] = $action; $plantInfo['actions'] = $action;
return $this->success('请求成功',$plantInfo->toArray()); return $this->success('请求成功',$plantInfo->toArray());
} }
} }