diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index c1b8616..1118c6d 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -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'];