update
This commit is contained in:
parent
676bb5627e
commit
ae32963785
|
@ -124,12 +124,15 @@ class FenceHouseLogic extends BaseLogic
|
||||||
public static function detail($params): array
|
public static function detail($params): array
|
||||||
{
|
{
|
||||||
$data = FenceHouse::findOrEmpty($params['id'])->toArray();
|
$data = FenceHouse::findOrEmpty($params['id'])->toArray();
|
||||||
$product = Product::where('fence_house_id', $params['id'])->findOrEmpty()->toArray();
|
$product = Product::where('fence_house_id', $data['id'])->findOrEmpty()->toArray();
|
||||||
$deviceIds = ProductDevice::where('product_id', $product['id'])->column('device_id');
|
$data['video_url'] = '';
|
||||||
$device = Device::whereIn('id', $deviceIds)->where('type', 2)->findOrEmpty();
|
$data['device_id'] = 0;
|
||||||
$data['video_url'] = $device['video_url'];
|
if (!empty($product)) {
|
||||||
$data['device_id'] = $device['id'];
|
$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'];
|
||||||
|
$data['device_id'] = $device['id'];
|
||||||
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue