MAPG-106 query indoor pano too if no outdoor pano is found
This commit is contained in:
parent
e817a34a3a
commit
618f2a4d48
@ -77,7 +77,7 @@ class PlaceRepository
|
|||||||
return $place;
|
return $place;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function requestPanoId(array $place): ?string
|
private function requestPanoId(array $place, bool $canBeIndoor = false): ?string
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
$place['pano_id_cached_timestamp'] &&
|
$place['pano_id_cached_timestamp'] &&
|
||||||
@ -90,7 +90,7 @@ class PlaceRepository
|
|||||||
$request->setQuery([
|
$request->setQuery([
|
||||||
'key' => $_ENV['GOOGLE_MAPS_SERVER_API_KEY'],
|
'key' => $_ENV['GOOGLE_MAPS_SERVER_API_KEY'],
|
||||||
'location' => $place['lat'] . ',' . $place['lng'],
|
'location' => $place['lat'] . ',' . $place['lng'],
|
||||||
'source' => 'outdoor'
|
'source' => $canBeIndoor ? 'default' : 'outdoor'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response = $request->send();
|
$response = $request->send();
|
||||||
@ -99,6 +99,11 @@ class PlaceRepository
|
|||||||
|
|
||||||
$panoId = $panoData['status'] === 'OK' ? $panoData['pano_id'] : null;
|
$panoId = $panoData['status'] === 'OK' ? $panoData['pano_id'] : null;
|
||||||
|
|
||||||
|
// enable indoor panos if no outdoor found
|
||||||
|
if ($panoId === null && !$canBeIndoor) {
|
||||||
|
return $this->requestPanoId($place, true);
|
||||||
|
}
|
||||||
|
|
||||||
$this->saveCachedPanoId($place['id'], $panoId);
|
$this->saveCachedPanoId($place['id'], $panoId);
|
||||||
|
|
||||||
return $panoId;
|
return $panoId;
|
||||||
|
Loading…
Reference in New Issue
Block a user