From 4770d6bef7f4ae08655634940c9530873dc1b936 Mon Sep 17 00:00:00 2001 From: weiz Date: Tue, 28 Nov 2023 11:27:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A7=86=E9=A2=91=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 33 +++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index f1b6d4ff..35549dd4 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -3,6 +3,7 @@ namespace app\api\controller; use app\common\enum\notice\NoticeEnum; use app\common\model\action\Action; +use app\common\model\device\Device; use app\common\model\land\Land; use app\common\model\land\LandProduct; use app\common\model\monitor\MonitorData; @@ -22,6 +23,7 @@ class IndexController extends BaseApiController public array $notNeedLogin = ['code','suYuan']; + //溯源首页 public function index(): Json { $params = $this->request->get(['land_id']); @@ -66,16 +68,35 @@ class IndexController extends BaseApiController '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); } + //视频监控 + public function video() { + $params = $this->request->get(['land_id']); + if(empty($params['land_id'])){ + return $this->fail('参数错误'); + } + //获取土地绑定的产品 + $landProduct = LandProduct::where('land_id',$params['land_id'])->findOrEmpty(); + if($landProduct->isEmpty()){ + return $this->fail('当前土地未绑定设备产品'); + } + //获取监控设备 + $productDevice = ProductDevice::where('product_id',$landProduct['product_id'])->where('device_type',3)->findOrEmpty(); + if($productDevice->isEmpty()){ + return $this->fail('当前土地未绑定监控设备'); + } + //获取设备编号 + $device = Device::where('id',$productDevice['device_id'])->findOrEmpty(); + if($device->isEmpty()){ + return $this->fail('监控设备信息错误'); + } + //获取监控数据 + //todo + } + // 获取短信验证码 public function code(): Json {