mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
remove another query
This commit is contained in:
parent
393f50f04e
commit
932ea5e893
@ -137,38 +137,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($customParameters as $key => $customParameter) {
|
||||
if ($key == 0) {
|
||||
$jsonQuery = "(";
|
||||
}
|
||||
$cfId = $customParameter['id'];
|
||||
$cfValue = $customParameter['value'];
|
||||
$cf = "'" . $cfId . "'";
|
||||
$valueCount = count($cfValue);
|
||||
if ($this->model->is_enabled('customfields')) {
|
||||
$query = app('Visiosoft\CustomfieldsModule\Http\Controller\cfController')->filterSearch($customParameters, $query);
|
||||
}
|
||||
|
||||
if ($cfValue) {
|
||||
foreach ($cfValue as $key1 => $value) {
|
||||
if ($key1 == 0 and $cfValue > 1) {
|
||||
$jsonQuery = $jsonQuery . "(";
|
||||
}
|
||||
$jsonQuery = $jsonQuery . 'JSON_CONTAINS(cf_json, \'"' . $value . '"\', ' . $cf . ')';
|
||||
if ($key1 == $valueCount - 1 and $cfValue > 1) {
|
||||
$jsonQuery = $jsonQuery . ")";
|
||||
}
|
||||
if ($key1 < $valueCount - 1) {
|
||||
$jsonQuery = $jsonQuery . " or ";
|
||||
} elseif ($key1 == $valueCount - 1 and $key != count($customParameters) - 1) {
|
||||
$jsonQuery = $jsonQuery . " and ";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($key == count($customParameters) - 1) {
|
||||
$jsonQuery = $jsonQuery . ")";
|
||||
}
|
||||
}
|
||||
if (isset($jsonQuery)) {
|
||||
$query = $query->whereRaw($jsonQuery);
|
||||
}
|
||||
|
||||
if (!empty($param['max_price'])) {
|
||||
$num = $param['max_price'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user