udpate 溯源首页详情接口
This commit is contained in:
parent
0fc1f7fcc3
commit
8df9a67241
|
@ -6,6 +6,7 @@ use app\common\model\action\Action;
|
||||||
use app\common\model\device\Device;
|
use app\common\model\device\Device;
|
||||||
use app\common\model\land\Land;
|
use app\common\model\land\Land;
|
||||||
use app\common\model\land\LandProduct;
|
use app\common\model\land\LandProduct;
|
||||||
|
use app\common\model\LandCollection;
|
||||||
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 app\common\model\product\ProductDevice;
|
||||||
|
@ -42,30 +43,30 @@ class IndexController extends BaseApiController
|
||||||
if($landProduct->isEmpty()){
|
if($landProduct->isEmpty()){
|
||||||
$data['monitor'] = [];
|
$data['monitor'] = [];
|
||||||
}else{
|
}else{
|
||||||
$monitor = MonitorData::where('product_id',$landProduct['product_id'])->order('id desc')->findOrEmpty();
|
$landCollection = LandCollection::where('land_id',$params['land_id'])->order('id desc')->findOrEmpty();
|
||||||
if($monitor->isEmpty()){
|
if($landCollection->isEmpty()){
|
||||||
$data['monitor'] = [];
|
$data['monitor'] = [];
|
||||||
}else{
|
}else{
|
||||||
$data['monitor']['soil_monitor_data'] = [
|
$data['monitor']['soil_monitor_data'] = [
|
||||||
'wind_direction'=>$monitor['wind_direction'],
|
'wind_direction'=>$landCollection['wind_direction'],
|
||||||
'wind_speed'=>$monitor['wind_speed'],
|
'wind_speed'=>$landCollection['wind_speed'],
|
||||||
'air_temperature'=>$monitor['air_temperature'],
|
'air_temperature'=>$landCollection['ambient_temperature'],
|
||||||
'air_moisture'=>$monitor['air_moisture'],
|
'air_moisture'=>$landCollection['ambient_humidity'],
|
||||||
'co2_content'=>$monitor['co2_content'],
|
'co2_content'=>$landCollection['carbon_dioxide'],
|
||||||
'pressure'=>$monitor['pressure'],
|
'pressure'=>$landCollection['ambient_air_pressure'],
|
||||||
'rainfall'=>$monitor['rainfall'],
|
'rainfall'=>$landCollection['rainfall'],
|
||||||
'light_intensity'=>$monitor['light_intensity'],
|
'light_intensity'=>$landCollection['ambient_lighting'],
|
||||||
'create_time' => $monitor['create_time']
|
'create_time' => $landCollection['create_time']
|
||||||
];
|
];
|
||||||
$data['monitor']['air_monitor_data'] = [
|
$data['monitor']['air_monitor_data'] = [
|
||||||
'soil_temperature'=>$monitor['soil_temperature'],
|
'soil_temperature'=>$landCollection['soil_temperature'],
|
||||||
'soil_moisture'=>$monitor['soil_moisture'],
|
'soil_moisture'=>$landCollection['soil_moisture'],
|
||||||
'conductivity'=>$monitor['conductivity'],
|
'conductivity'=>$landCollection['soil_conductivity'],
|
||||||
'ph'=>$monitor['ph'],
|
'ph'=>$landCollection['soil_PH'],
|
||||||
'n_content'=>$monitor['n_content'],
|
'n_content'=>$landCollection['soil_potassium_phosphate_nitrogen'],
|
||||||
'p_content'=>$monitor['p_content'],
|
'p_content'=>$landCollection['soil_potassium_phosphate_phosphorus'],
|
||||||
'k_content'=>$monitor['k_content'],
|
'k_content'=>$landCollection['soil_potassium_phosphate_potassium'],
|
||||||
'create_time' => $monitor['create_time']
|
'create_time' => $landCollection['create_time']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue