73 lines
1.6 KiB
PHP
73 lines
1.6 KiB
PHP
<?php
|
|
|
|
class CityServiceApi extends Api {
|
|
|
|
public $apiName = 'cityservices';
|
|
|
|
public function __construct($requestUri, $encryption=true) {
|
|
$encryption = false; // We do not need encryption for this class
|
|
parent::__construct($requestUri, $encryption);
|
|
//$this->encryption = $encryption;
|
|
}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/SAVVY/touristattraction/api/touristattraction?city={city}&country={country}",
|
|
* security={{"token": {}}},
|
|
* summary="Get geofenceareacity by city and country code",
|
|
* @OA\Response(
|
|
* response="200",
|
|
* description="Found geofence area city",
|
|
* @OA\JsonContent(
|
|
* type="object"
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function indexAction() {
|
|
$message = 'No locations found';
|
|
|
|
$city = $this->requestParams['city'] ?? '';
|
|
$results = [];
|
|
$res_status = 404;
|
|
|
|
try {
|
|
if (empty($city)) {
|
|
throw new Exception("Invalid city");
|
|
}
|
|
|
|
$db = new Db();
|
|
list($results, $err) = CityServiceModel::get( $db->getConnect(), $city );
|
|
if (!empty($err)) {
|
|
$result = [
|
|
"services" => NULL,
|
|
"error" => $err
|
|
];
|
|
} else {
|
|
$result = [
|
|
"services" => $results,
|
|
];
|
|
$res_status = 200;
|
|
}
|
|
} catch (Exception $e) {
|
|
$message = $e->getMessage();
|
|
$result = [
|
|
"services" => NULL,
|
|
"error" => $message
|
|
];
|
|
}
|
|
|
|
return $this->response($result, $res_status);
|
|
}
|
|
|
|
public function viewAction() {}
|
|
|
|
public function createAction() {}
|
|
|
|
public function updateAction() {}
|
|
|
|
public function deleteAction() {}
|
|
}
|
|
|
|
|