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

Reviewed-on: #27
This commit is contained in:
weiz 2023-11-29 11:10:22 +08:00
commit 56f5d9f570
2 changed files with 7 additions and 9 deletions

View File

@ -73,7 +73,8 @@ class IndexController extends BaseApiController
} }
//视频监控 //视频监控
public function video() { public function video(): Json
{
$params = $this->request->get(['land_id']); $params = $this->request->get(['land_id']);
if(empty($params['land_id'])){ if(empty($params['land_id'])){
return $this->fail('参数错误'); return $this->fail('参数错误');
@ -84,17 +85,13 @@ class IndexController extends BaseApiController
return $this->fail('当前土地未绑定设备产品'); return $this->fail('当前土地未绑定设备产品');
} }
//获取监控设备 //获取监控设备
$productDevice = ProductDevice::where('product_id',$landProduct['product_id'])->where('device_type',3)->findOrEmpty(); $productDevice = ProductDevice::where('product_id',$landProduct['product_id'])->where('device_type',3)->column('device_id');
if($productDevice->isEmpty()){ if(empty($productDevice)){
return $this->fail('当前土地未绑定监控设备'); return $this->fail('当前土地未绑定监控设备');
} }
//获取设备编号 //获取设备编号
$device = Device::where('id',$productDevice['device_id'])->findOrEmpty(); $device = Device::where('id','in',$productDevice)->select();
if($device->isEmpty()){ return $this->success('请求成功',$device->toArray());
return $this->fail('监控设备信息错误');
}
//获取监控数据
//todo
} }
// 获取短信验证码 // 获取短信验证码

View File

@ -181,6 +181,7 @@
]); ]);
Device::where('id','in',$productDevice)->update([ Device::where('id','in',$productDevice)->update([
'user_id' => $land['user_id'], 'user_id' => $land['user_id'],
'is_bind' => 2,
'update_time' => time() 'update_time' => time()
]); ]);
}); });