2014-07-22 19:20:43 +04:00
|
|
|
<?php
|
2017-02-11 18:16:56 +03:00
|
|
|
class LeBonCoinBridge extends BridgeAbstract {
|
2014-07-22 19:20:43 +04:00
|
|
|
|
2018-07-16 21:13:08 +03:00
|
|
|
const MAINTAINER = 'jacknumber';
|
2017-02-11 18:16:56 +03:00
|
|
|
const NAME = 'LeBonCoin';
|
2017-03-21 23:27:12 +03:00
|
|
|
const URI = 'https://www.leboncoin.fr/';
|
2018-07-16 21:13:08 +03:00
|
|
|
const DESCRIPTION = 'Returns most recent results from LeBonCoin';
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2017-02-11 18:16:56 +03:00
|
|
|
const PARAMETERS = array(
|
|
|
|
array(
|
2018-08-31 16:34:41 +03:00
|
|
|
'keywords' => array('name' => 'Mots-Clés'),
|
|
|
|
'region' => array(
|
2017-02-11 18:16:56 +03:00
|
|
|
'name' => 'Région',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Toute la France' => '',
|
|
|
|
'Alsace' => '1',
|
|
|
|
'Aquitaine' => '2',
|
|
|
|
'Auvergne' => '3',
|
|
|
|
'Basse Normandie' => '4',
|
|
|
|
'Bourgogne' => '5',
|
|
|
|
'Bretagne' => '6',
|
|
|
|
'Centre' => '7',
|
|
|
|
'Champagne Ardenne' => '8',
|
|
|
|
'Corse' => '9',
|
|
|
|
'Franche Comté' => '10',
|
|
|
|
'Haute Normandie' => '11',
|
|
|
|
'Ile de France' => '12',
|
|
|
|
'Languedoc Roussillon' => '13',
|
|
|
|
'Limousin' => '14',
|
|
|
|
'Lorraine' => '15',
|
|
|
|
'Midi Pyrénées' => '16',
|
|
|
|
'Nord Pas De Calais' => '17',
|
|
|
|
'Pays de la Loire' => '18',
|
|
|
|
'Picardie' => '19',
|
|
|
|
'Poitou Charentes' => '20',
|
|
|
|
'Provence Alpes Côte d\'Azur' => '21',
|
|
|
|
'Rhône-Alpes' => '22',
|
|
|
|
'Guadeloupe' => '23',
|
|
|
|
'Martinique' => '24',
|
|
|
|
'Guyane' => '25',
|
|
|
|
'Réunion' => '26'
|
2017-02-11 18:16:56 +03:00
|
|
|
)
|
|
|
|
),
|
2018-08-31 16:34:41 +03:00
|
|
|
'department' => array(
|
|
|
|
'name' => 'Département',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => array(
|
|
|
|
'' => '',
|
|
|
|
'Ain' => '1',
|
|
|
|
'Aisne' => '2',
|
|
|
|
'Allier' => '3',
|
|
|
|
'Alpes-de-Haute-Provence' => '4',
|
|
|
|
'Hautes-Alpes' => '5',
|
|
|
|
'Alpes-Maritimes' => '6',
|
|
|
|
'Ardèche' => '7',
|
|
|
|
'Ardennes' => '8',
|
|
|
|
'Ariège' => '9',
|
|
|
|
'Aube' => '10',
|
|
|
|
'Aude' => '11',
|
|
|
|
'Aveyron' => '12',
|
|
|
|
'Bouches-du-Rhône' => '13',
|
|
|
|
'Calvados' => '14',
|
|
|
|
'Cantal' => '15',
|
|
|
|
'Charente' => '16',
|
|
|
|
'Charente-Maritime' => '17',
|
|
|
|
'Cher' => '18',
|
|
|
|
'Corrèze' => '19',
|
|
|
|
'Corse-du-Sud' => '2A',
|
|
|
|
'Haute-Corse' => '2B',
|
|
|
|
'Côte-d\'Or' => '21',
|
|
|
|
'Côtes-d\'Armor' => '22',
|
|
|
|
'Creuse' => '23',
|
|
|
|
'Dordogne' => '24',
|
|
|
|
'Doubs' => '25',
|
|
|
|
'Drôme' => '26',
|
|
|
|
'Eure' => '27',
|
|
|
|
'Eure-et-Loir' => '28',
|
|
|
|
'Finistère' => '29',
|
|
|
|
'Gard' => '30',
|
|
|
|
'Haute-Garonne' => '31',
|
|
|
|
'Gers' => '32',
|
|
|
|
'Gironde' => '33',
|
|
|
|
'Hérault' => '34',
|
|
|
|
'Ille-et-Vilaine' => '35',
|
|
|
|
'Indre' => '36',
|
|
|
|
'Indre-et-Loire' => '37',
|
|
|
|
'Isère' => '38',
|
|
|
|
'Jura' => '39',
|
|
|
|
'Landes' => '40',
|
|
|
|
'Loir-et-Cher' => '41',
|
|
|
|
'Loire' => '42',
|
|
|
|
'Haute-Loire' => '43',
|
|
|
|
'Loire-Atlantique' => '44',
|
|
|
|
'Loiret' => '45',
|
|
|
|
'Lot' => '46',
|
|
|
|
'Lot-et-Garonne' => '47',
|
|
|
|
'Lozère' => '48',
|
|
|
|
'Maine-et-Loire' => '49',
|
|
|
|
'Manche' => '50',
|
|
|
|
'Marne' => '51',
|
|
|
|
'Haute-Marne' => '52',
|
|
|
|
'Mayenne' => '53',
|
|
|
|
'Meurthe-et-Moselle' => '54',
|
|
|
|
'Meuse' => '55',
|
|
|
|
'Morbihan' => '56',
|
|
|
|
'Moselle' => '57',
|
|
|
|
'Nièvre' => '58',
|
|
|
|
'Nord' => '59',
|
|
|
|
'Oise' => '60',
|
|
|
|
'Orne' => '61',
|
|
|
|
'Pas-de-Calais' => '62',
|
|
|
|
'Puy-de-Dôme' => '63',
|
|
|
|
'Pyrénées-Atlantiques' => '64',
|
|
|
|
'Hautes-Pyrénées' => '65',
|
|
|
|
'Pyrénées-Orientales' => '66',
|
|
|
|
'Bas-Rhin' => '67',
|
|
|
|
'Haut-Rhin' => '68',
|
|
|
|
'Rhône' => '69',
|
|
|
|
'Haute-Saône' => '70',
|
|
|
|
'Saône-et-Loire' => '71',
|
|
|
|
'Sarthe' => '72',
|
|
|
|
'Savoie' => '73',
|
|
|
|
'Haute-Savoie' => '74',
|
|
|
|
'Paris' => '75',
|
|
|
|
'Seine-Maritime' => '76',
|
|
|
|
'Seine-et-Marne' => '77',
|
|
|
|
'Yvelines' => '78',
|
|
|
|
'Deux-Sèvres' => '79',
|
|
|
|
'Somme' => '80',
|
|
|
|
'Tarn' => '81',
|
|
|
|
'Tarn-et-Garonne' => '82',
|
|
|
|
'Var' => '83',
|
|
|
|
'Vaucluse' => '84',
|
|
|
|
'Vendée' => '85',
|
|
|
|
'Vienne' => '86',
|
|
|
|
'Haute-Vienne' => '87',
|
|
|
|
'Vosges' => '88',
|
|
|
|
'Yonne' => '89',
|
|
|
|
'Territoire de Belfort' => '90',
|
|
|
|
'Essonne' => '91',
|
|
|
|
'Hauts-de-Seine' => '92',
|
|
|
|
'Seine-Saint-Denis' => '93',
|
|
|
|
'Val-de-Marne' => '94',
|
|
|
|
'Val-d\'Oise' => '95'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'cities' => array(
|
|
|
|
'name' => 'Villes',
|
|
|
|
'title' => 'Codes postaux séparés par des virgules'
|
|
|
|
),
|
|
|
|
'category' => array(
|
2017-02-11 18:16:56 +03:00
|
|
|
'name' => 'Catégorie',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Toutes catégories' => '',
|
|
|
|
'EMPLOI' => array(
|
|
|
|
'Emploi et recrutement' => '71',
|
|
|
|
'Offres d\'emploi et jobs' => '33'
|
|
|
|
),
|
2018-08-31 16:34:41 +03:00
|
|
|
'VÉHICULES' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '1',
|
|
|
|
'Voitures' => '2',
|
|
|
|
'Motos' => '3',
|
|
|
|
'Caravaning' => '4',
|
|
|
|
'Utilitaires' => '5',
|
|
|
|
'Equipement Auto' => '6',
|
|
|
|
'Equipement Moto' => '44',
|
|
|
|
'Equipement Caravaning' => '50',
|
|
|
|
'Nautisme' => '7',
|
|
|
|
'Equipement Nautisme' => '51'
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
|
|
|
'IMMOBILIER' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '8',
|
|
|
|
'Ventes immobilières' => '9',
|
|
|
|
'Locations' => '10',
|
|
|
|
'Colocations' => '11',
|
|
|
|
'Bureaux & Commerces' => '13'
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
|
|
|
'VACANCES' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '66',
|
|
|
|
'Locations & Gîtes' => '12',
|
|
|
|
'Chambres d\'hôtes' => '67',
|
|
|
|
'Campings' => '68',
|
|
|
|
'Hôtels' => '69',
|
|
|
|
'Hébergements insolites' => '70'
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
2018-08-31 16:34:41 +03:00
|
|
|
'MULTIMÉDIA' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '14',
|
|
|
|
'Informatique' => '15',
|
|
|
|
'Consoles & Jeux vidéo' => '43',
|
|
|
|
'Image & Son' => '16',
|
|
|
|
'Téléphonie' => '17'
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
|
|
|
'LOISIRS' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '24',
|
|
|
|
'DVD / Films' => '25',
|
|
|
|
'CD / Musique' => '26',
|
|
|
|
'Livres' => '27',
|
|
|
|
'Animaux' => '28',
|
|
|
|
'Vélos' => '55',
|
|
|
|
'Sports & Hobbies' => '29',
|
|
|
|
'Instruments de musique' => '30',
|
|
|
|
'Collection' => '40',
|
|
|
|
'Jeux & Jouets' => '41',
|
|
|
|
'Vins & Gastronomie' => '48'
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
2018-08-31 16:34:41 +03:00
|
|
|
'MATÉRIEL PROFESSIONNEL' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '56',
|
|
|
|
'Matériel Agricole' => '57',
|
|
|
|
'Transport - Manutention' => '58',
|
|
|
|
'BTP - Chantier Gros-oeuvre' => '59',
|
|
|
|
'Outillage - Matériaux 2nd-oeuvre' => '60',
|
|
|
|
'Équipements Industriels' => '32',
|
|
|
|
'Restauration - Hôtellerie' => '61',
|
|
|
|
'Fournitures de Bureau' => '62',
|
|
|
|
'Commerces & Marchés' => '63',
|
|
|
|
'Matériel Médical' => '64'
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
|
|
|
'SERVICES' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '31',
|
|
|
|
'Prestations de services' => '34',
|
|
|
|
'Billetterie' => '35',
|
2018-08-31 16:34:41 +03:00
|
|
|
'Événements' => '49',
|
2018-07-16 21:13:08 +03:00
|
|
|
'Cours particuliers' => '36',
|
|
|
|
'Covoiturage' => '65'
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
|
|
|
'MAISON' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'Tous' => '18',
|
|
|
|
'Ameublement' => '19',
|
2018-08-31 16:34:41 +03:00
|
|
|
'Électroménager' => '20',
|
2018-07-16 21:13:08 +03:00
|
|
|
'Arts de la table' => '45',
|
|
|
|
'Décoration' => '39',
|
|
|
|
'Linge de maison' => '46',
|
|
|
|
'Bricolage' => '21',
|
|
|
|
'Jardinage' => '52',
|
|
|
|
'Vêtements' => '22',
|
|
|
|
'Chaussures' => '53',
|
|
|
|
'Accessoires & Bagagerie' => '47',
|
|
|
|
'Montres & Bijoux' => '42',
|
2018-08-31 16:34:41 +03:00
|
|
|
'Équipement bébé' => '23',
|
2018-07-16 21:13:08 +03:00
|
|
|
'Vêtements bébé' => '54',
|
2017-02-11 18:16:56 +03:00
|
|
|
),
|
2018-07-16 21:13:08 +03:00
|
|
|
'AUTRES' => '37'
|
|
|
|
)
|
|
|
|
),
|
2018-08-31 16:34:41 +03:00
|
|
|
'pricemin' => array(
|
|
|
|
'name' => 'Prix min',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'pricemax' => array(
|
|
|
|
'name' => 'Prix max',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'estate' => array(
|
|
|
|
'name' => 'Type de bien',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => array(
|
|
|
|
'' => '',
|
|
|
|
'Maison' => '1',
|
|
|
|
'Appartement' => '2',
|
|
|
|
'Terrain' => '3',
|
|
|
|
'Parking' => '4',
|
|
|
|
'Autre' => '5'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'roomsmin' => array(
|
|
|
|
'name' => 'Pièces min',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'roomsmax' => array(
|
|
|
|
'name' => 'Pièces max',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'squaremin' => array(
|
|
|
|
'name' => 'Surface min',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'squaremax' => array(
|
|
|
|
'name' => 'Surface max',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'mileagemin' => array(
|
|
|
|
'name' => 'Kilométrage min',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'mileagemax' => array(
|
|
|
|
'name' => 'Kilométrage max',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'yearmin' => array(
|
|
|
|
'name' => 'Année min',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'yearmax' => array(
|
|
|
|
'name' => 'Année max',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'cubiccapacitymin' => array(
|
|
|
|
'name' => 'Cylindrée min',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'cubiccapacitymax' => array(
|
|
|
|
'name' => 'Cylindrée max',
|
|
|
|
'type' => 'number'
|
|
|
|
),
|
|
|
|
'fuel' => array(
|
|
|
|
'name' => 'Énergie',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => array(
|
|
|
|
'' => '',
|
|
|
|
'Essence' => '1',
|
|
|
|
'Diesel' => '2',
|
|
|
|
'GPL' => '3',
|
|
|
|
'Électrique' => '4',
|
|
|
|
'Hybride' => '6',
|
|
|
|
'Autre' => '5'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'owner' => array(
|
2018-07-16 21:13:08 +03:00
|
|
|
'name' => 'Vendeur',
|
|
|
|
'type' => 'list',
|
|
|
|
'values' => array(
|
|
|
|
'Tous' => '',
|
|
|
|
'Particuliers' => 'private',
|
2018-08-31 16:34:41 +03:00
|
|
|
'Professionnels' => 'pro'
|
2017-02-11 18:16:56 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2015-11-05 18:50:18 +03:00
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
public static $LBC_API_KEY = 'ba0c2dad52b3ec';
|
|
|
|
|
2018-08-31 16:34:41 +03:00
|
|
|
private function getRange($field, $range_min, $range_max){
|
|
|
|
|
|
|
|
if(!is_null($range_min)
|
|
|
|
&& !is_null($range_max)
|
|
|
|
&& $range_min > $range_max) {
|
|
|
|
returnClientError('Min-' . $field . ' must be lower than max-' . $field . '.');
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!is_null($range_min)
|
|
|
|
&& is_null($range_max)) {
|
|
|
|
returnClientError('Max-' . $field . ' is needed when min-' . $field . ' is setted (range).');
|
|
|
|
}
|
|
|
|
|
|
|
|
return array(
|
|
|
|
'min' => $range_min,
|
|
|
|
'max' => $range_max
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-08-25 02:24:53 +03:00
|
|
|
public function collectData(){
|
2016-05-02 01:55:22 +03:00
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
$url = 'https://api.leboncoin.fr/finder/search/';
|
|
|
|
$data = $this->buildRequestJson();
|
|
|
|
|
|
|
|
$header = array(
|
2019-08-26 15:22:58 +03:00
|
|
|
'User-Agent: LBC;Android;Null;Null;Null;Null;Null;Null;Null;Null',
|
2018-08-28 16:20:02 +03:00
|
|
|
'Content-Type: application/json',
|
|
|
|
'Content-Length: ' . strlen($data),
|
|
|
|
'api_key: ' . self::$LBC_API_KEY
|
2018-07-16 21:13:08 +03:00
|
|
|
);
|
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
$opts = array(
|
2018-09-12 15:31:11 +03:00
|
|
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
2018-08-28 16:20:02 +03:00
|
|
|
CURLOPT_POSTFIELDS => $data
|
2018-08-22 18:21:39 +03:00
|
|
|
|
|
|
|
);
|
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
$content = getContents($url, $header, $opts)
|
2018-07-16 21:13:08 +03:00
|
|
|
or returnServerError('Could not request LeBonCoin. Tried: ' . $url);
|
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
$json = json_decode($content);
|
2016-05-02 01:55:22 +03:00
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
if($json->total === 0) {
|
2016-05-02 01:55:22 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
foreach($json->ads as $element) {
|
2018-07-16 21:13:08 +03:00
|
|
|
|
|
|
|
$item['title'] = $element->subject;
|
|
|
|
$item['content'] = $element->body;
|
|
|
|
$item['date'] = $element->index_date;
|
|
|
|
$item['timestamp'] = strtotime($element->index_date);
|
|
|
|
$item['uri'] = $element->url;
|
|
|
|
$item['ad_type'] = $element->ad_type;
|
|
|
|
$item['author'] = $element->owner->name;
|
2016-05-02 01:55:22 +03:00
|
|
|
|
2018-07-16 21:13:08 +03:00
|
|
|
if(isset($element->location->city)) {
|
2016-05-02 01:55:22 +03:00
|
|
|
|
2018-07-16 21:13:08 +03:00
|
|
|
$item['city'] = $element->location->city;
|
|
|
|
$item['content'] .= ' -- ' . $element->location->city;
|
2016-05-02 01:55:22 +03:00
|
|
|
|
2018-07-16 21:13:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($element->location->zipcode)) {
|
|
|
|
$item['zipcode'] = $element->location->zipcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($element->price)) {
|
|
|
|
|
|
|
|
$item['price'] = $element->price[0];
|
|
|
|
$item['content'] .= ' -- ' . current($element->price) . '€';
|
2016-05-02 01:55:22 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-16 21:13:08 +03:00
|
|
|
if(isset($element->images->urls)) {
|
|
|
|
|
|
|
|
$item['thumbnail'] = $element->images->thumb_url;
|
|
|
|
$item['enclosures'] = array();
|
2016-05-02 01:55:22 +03:00
|
|
|
|
2018-07-16 21:13:08 +03:00
|
|
|
foreach($element->images->urls as $image) {
|
|
|
|
$item['enclosures'][] = $image;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-05-02 01:55:22 +03:00
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
2018-08-28 16:20:02 +03:00
|
|
|
|
|
|
|
private function buildRequestJson() {
|
|
|
|
|
|
|
|
$requestJson = new StdClass();
|
2018-08-31 16:34:41 +03:00
|
|
|
$requestJson->owner_type = $this->getInput('owner');
|
2018-09-12 15:31:11 +03:00
|
|
|
$requestJson->filters = new StdClass();
|
2018-08-31 16:34:41 +03:00
|
|
|
|
|
|
|
$requestJson->filters->keywords = array(
|
|
|
|
'text' => $this->getInput('keywords')
|
|
|
|
);
|
|
|
|
|
|
|
|
if($this->getInput('region') != '') {
|
2019-11-01 20:06:38 +03:00
|
|
|
$requestJson->filters->location['regions'] = array($this->getInput('region'));
|
2018-08-31 16:34:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('department') != '') {
|
2019-11-01 20:06:38 +03:00
|
|
|
$requestJson->filters->location['departments'] = array($this->getInput('department'));
|
2018-08-28 16:20:02 +03:00
|
|
|
}
|
2018-08-31 16:34:41 +03:00
|
|
|
|
2018-08-28 16:20:02 +03:00
|
|
|
if($this->getInput('cities') != '') {
|
|
|
|
|
|
|
|
$requestJson->filters->location['city_zipcodes'] = array();
|
|
|
|
|
|
|
|
foreach (explode(',', $this->getInput('cities')) as $zipcode) {
|
|
|
|
|
|
|
|
$requestJson->filters->location['city_zipcodes'][] = array(
|
|
|
|
'zipcode' => trim($zipcode)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$requestJson->filters->category = array(
|
2018-08-31 16:34:41 +03:00
|
|
|
'id' => $this->getInput('category')
|
2018-08-28 16:20:02 +03:00
|
|
|
);
|
|
|
|
|
2018-08-31 16:34:41 +03:00
|
|
|
if($this->getInput('pricemin') != ''
|
|
|
|
|| $this->getInput('pricemax') != '') {
|
|
|
|
|
|
|
|
$requestJson->filters->ranges->price = $this->getRange(
|
|
|
|
'price',
|
|
|
|
$this->getInput('pricemin'),
|
|
|
|
$this->getInput('pricemax')
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('estate') != '') {
|
2019-11-01 20:06:38 +03:00
|
|
|
$requestJson->filters->enums['real_estate_type'] = array($this->getInput('estate'));
|
2018-08-31 16:34:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('roomsmin') != ''
|
|
|
|
|| $this->getInput('roomsmax') != '') {
|
|
|
|
|
|
|
|
$requestJson->filters->ranges->rooms = $this->getRange(
|
|
|
|
'rooms',
|
|
|
|
$this->getInput('roomsmin'),
|
|
|
|
$this->getInput('roomsmax')
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('squaremin') != ''
|
|
|
|
|| $this->getInput('squaremax') != '') {
|
|
|
|
|
|
|
|
$requestJson->filters->ranges->square = $this->getRange(
|
|
|
|
'square',
|
|
|
|
$this->getInput('squaremin'),
|
|
|
|
$this->getInput('squaremax')
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('mileagemin') != ''
|
|
|
|
|| $this->getInput('mileagemax') != '') {
|
|
|
|
|
|
|
|
$requestJson->filters->ranges->mileage = $this->getRange(
|
|
|
|
'mileage',
|
|
|
|
$this->getInput('mileagemin'),
|
|
|
|
$this->getInput('mileagemax')
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('yearmin') != ''
|
|
|
|
|| $this->getInput('yearmax') != '') {
|
|
|
|
|
|
|
|
$requestJson->filters->ranges->regdate = $this->getRange(
|
|
|
|
'year',
|
|
|
|
$this->getInput('yearmin'),
|
|
|
|
$this->getInput('yearmax')
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('cubiccapacitymin') != ''
|
|
|
|
|| $this->getInput('cubiccapacitymax') != '') {
|
|
|
|
|
|
|
|
$requestJson->filters->ranges->cubic_capacity = $this->getRange(
|
|
|
|
'cubic_capacity',
|
|
|
|
$this->getInput('cubiccapacitymin'),
|
|
|
|
$this->getInput('cubiccapacitymax')
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->getInput('fuel') != '') {
|
2019-11-01 20:06:38 +03:00
|
|
|
$requestJson->filters->enums['fuel'] = array($this->getInput('fuel'));
|
2018-08-31 16:34:41 +03:00
|
|
|
}
|
2018-08-28 16:20:02 +03:00
|
|
|
|
|
|
|
$requestJson->limit = 30;
|
|
|
|
|
|
|
|
return json_encode($requestJson);
|
|
|
|
|
|
|
|
}
|
2016-07-08 20:06:35 +03:00
|
|
|
}
|