g1chapeau/lib/Gchange.class.php

87 lines
1.3 KiB
PHP

<?php
require_once('DAO.class.php');
class Gchange {
private $dao;
public function __construct () {
$this->dao = new DAO();
}
public function getNearbyOffers ($lat, $lon, $max, $min = NULL) {
$queryParams = [
'size' => 100,
'query' => [
'bool' => [
'must' => [
[
'geo_distance' => [
"distance" => "50km",
"geoPoint"=> [
"lat" => $lat,
"lon" => $lon
]
]
], [
'range' => [
'stock' => [
'gte' => 1
]
]
]
]
]
]
];
$json = $this->dao->fetchJson('/market/record/_search?pretty', 'gchange', $queryParams);
$result = json_decode($json);
return $result->hits->hits;
}
public function getImmaterialOffers () {
$queryParams = [
'size' => 100,
'query' => [
'bool' => [
'must' => [
[
'term' => [
'category' => [
[
'parent' => 'cat31'
]
]
]
]
]
]
]
];
$json = $this->dao->fetchJson('/market/record/_search?pretty', 'gchange', $queryParams);
$result = json_decode($json);
return $result->hits->hits;
}
public function getHousingOffers () {
}
public function getShippableOffers () {
}
}