From 2ab644ff2f88175304273edda5970822ea07920b Mon Sep 17 00:00:00 2001 From: weiz Date: Wed, 29 Nov 2023 11:09:47 +0800 Subject: [PATCH] update --- app/api/controller/IndexController.php | 15 ++++++--------- app/api/controller/LandController.php | 1 + 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 35549dd4..3fda6b20 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -73,7 +73,8 @@ class IndexController extends BaseApiController } //视频监控 - public function video() { + public function video(): Json + { $params = $this->request->get(['land_id']); if(empty($params['land_id'])){ return $this->fail('参数错误'); @@ -84,17 +85,13 @@ class IndexController extends BaseApiController return $this->fail('当前土地未绑定设备产品'); } //获取监控设备 - $productDevice = ProductDevice::where('product_id',$landProduct['product_id'])->where('device_type',3)->findOrEmpty(); - if($productDevice->isEmpty()){ + $productDevice = ProductDevice::where('product_id',$landProduct['product_id'])->where('device_type',3)->column('device_id'); + if(empty($productDevice)){ return $this->fail('当前土地未绑定监控设备'); } //获取设备编号 - $device = Device::where('id',$productDevice['device_id'])->findOrEmpty(); - if($device->isEmpty()){ - return $this->fail('监控设备信息错误'); - } - //获取监控数据 - //todo + $device = Device::where('id','in',$productDevice)->select(); + return $this->success('请求成功',$device->toArray()); } // 获取短信验证码 diff --git a/app/api/controller/LandController.php b/app/api/controller/LandController.php index ee1f7195..077b1126 100644 --- a/app/api/controller/LandController.php +++ b/app/api/controller/LandController.php @@ -181,6 +181,7 @@ ]); Device::where('id','in',$productDevice)->update([ 'user_id' => $land['user_id'], + 'is_bind' => 2, 'update_time' => time() ]); });