Compare commits
No commits in common. "3ee3060b9f98dbd98c7d36be83b570472462b0af" and "84a941a1fc1f36f85444227137d0a9fb2e8d2c63" have entirely different histories.
3ee3060b9f
...
84a941a1fc
|
@ -2,11 +2,12 @@
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
use app\common\enum\notice\NoticeEnum;
|
use app\common\enum\notice\NoticeEnum;
|
||||||
use app\common\model\action\Action;
|
|
||||||
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\monitor\AirMonitor;
|
||||||
use app\common\model\monitor\MonitorData;
|
use app\common\model\monitor\MonitorData;
|
||||||
use app\common\model\plant\Plant;
|
use app\common\model\monitor\SoilMonitor;
|
||||||
|
use app\common\model\product\ProductDevice;
|
||||||
use think\facade\Log;
|
use think\facade\Log;
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
|
|
||||||
|
@ -101,35 +102,8 @@ class IndexController extends BaseApiController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function suYuan(): Json
|
public function suYuan() {
|
||||||
{
|
|
||||||
$params = $this->request->get(['plant_id']);
|
|
||||||
if(empty($params['plant_id'])){
|
|
||||||
return $this->fail('参数错误');
|
|
||||||
}
|
|
||||||
$plantInfo = Plant::where('id',$params['plant_id'])->findOrEmpty();
|
|
||||||
if($plantInfo->isEmpty()){
|
|
||||||
return $this->fail('种植信息错误');
|
|
||||||
}
|
|
||||||
if($plantInfo['status'] != 2){
|
|
||||||
return $this->fail('种植信息状态错误');
|
|
||||||
}
|
|
||||||
$landInfo = Land::where('id',$plantInfo['land_id'])->findOrEmpty();
|
|
||||||
if($landInfo->isEmpty()){
|
|
||||||
return $this->fail('土地信息错误');
|
|
||||||
}
|
|
||||||
$plantInfo['pic'] = json_decode($plantInfo['pic'],true);
|
|
||||||
$plantInfo['plant_date'] = date('Y-m-d',$plantInfo['plant_date']);
|
|
||||||
$plantInfo['land_name'] = $landInfo['title'];
|
|
||||||
$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'];
|
|
||||||
//获取操作
|
|
||||||
$action = Action::field('type_text,detail,create_time')->where('plant_id',$params['plant_id'])->select()->each(function($item){
|
|
||||||
$item['detail'] = json_decode($item['detail'],true);
|
|
||||||
return $item;
|
|
||||||
})->toArray();
|
|
||||||
$plantInfo['actions'] = $action;
|
|
||||||
return $this->success('请求成功',$plantInfo->toArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue