76 lines
1.7 KiB
PHP
76 lines
1.7 KiB
PHP
<?php
|
|
|
|
class GeofenceAreaCityApi extends Api {
|
|
|
|
public $apiName = 'geofenceareacity';
|
|
|
|
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/travelguide/api/geofenceareacity?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 city found';
|
|
$result = [];
|
|
$res_status = 404;
|
|
|
|
try {
|
|
$params = [
|
|
'city' => $this->requestParams['city'] ?? '',
|
|
'country' => $this->requestParams['country'] ?? '',
|
|
'lat' => $this->requestParams['lat'] ?? '',
|
|
'lng' => $this->requestParams['lng'] ?? '',
|
|
'radius' => $this->requestParams['radius'] ?? '',
|
|
'status' => $this->requestParams['status'] ?? '',
|
|
];
|
|
|
|
$db = new Db();
|
|
list($city, $err) = GeofenceAreaCityModel::get( $db->getConnect(), $params );
|
|
if (!empty($err)) {
|
|
$result = [
|
|
"city" => NULL,
|
|
"error" => $err
|
|
];
|
|
} else {
|
|
$result = [
|
|
"city" => $city,
|
|
];
|
|
$res_status = 200;
|
|
}
|
|
} catch (Exception $e) {
|
|
$message = $e->getMessage();
|
|
$result = [
|
|
"city" => NULL,
|
|
"error" => $message
|
|
];
|
|
}
|
|
|
|
return $this->response($result, $res_status);
|
|
}
|
|
|
|
public function viewAction() {}
|
|
|
|
public function createAction() {}
|
|
|
|
public function updateAction() {}
|
|
|
|
public function deleteAction() {}
|
|
}
|
|
|
|
|