溯源操作

This commit is contained in:
chenbo 2024-01-29 09:25:59 +08:00
parent a0d6fa73b4
commit a9730932e8
1 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,9 @@ class IndexController extends BaseApiController
return $this->success('请求成功',[]);
}
$product = Product::where('fence_house_id', $data['id'])->findOrEmpty()->toArray();
if(empty($product)){
return $this->fail('栏舍暂未绑定产品',[]);
}
$deviceIds = ProductDevice::where('product_id', $product['id'])->column('device_id');
$device = Device::whereIn('id', $deviceIds)->where('type', 2)->findOrEmpty();
$data['video_url'] = $device['video_url'];