37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
class ComplexesController extends BaseController {
|
|
public $model = null;
|
|
|
|
public function __construct() {
|
|
$this->model = new ComplexesModel();
|
|
}
|
|
|
|
public function getComplexes($id) {
|
|
// Валидация и санитизация входных данных
|
|
if (!is_array($id)) {
|
|
return $this->response(['error' => 'Invalid ID'], 400);
|
|
}
|
|
|
|
$params = $id;
|
|
|
|
$catalog = $this->model->getComplexes($params);
|
|
return $this->response($catalog);
|
|
}
|
|
|
|
public function getApartment($id) {
|
|
// Валидация и санитизация входных данных
|
|
if (!is_array($id)) {
|
|
return $this->response(['error' => 'Invalid ID'], 400);
|
|
}
|
|
|
|
$token = isset($_GET['token']) ? filter_var($_GET['token'], FILTER_SANITIZE_STRING) : null;
|
|
|
|
if (!$token) {
|
|
return $this->response(['error' => 'Token is required'], 400);
|
|
}
|
|
|
|
$apartment = $this->model->getApartment($id, $token);
|
|
return $this->response($apartment);
|
|
}
|
|
} |