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