新增视频监控接口 #24

Merged
weiz merged 1 commits from zhangwei into dev 2023-11-28 11:28:29 +08:00
1 changed files with 27 additions and 6 deletions
Showing only changes of commit 4770d6bef7 - Show all commits

View File

@ -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
{