api
This commit is contained in:
parent
ec6bfa0946
commit
17963150e5
|
|
@ -77,6 +77,8 @@ class Api extends Backend
|
|||
$attr = $data['attr'] ?? null;
|
||||
$brand = $data['brand'] ?? null;
|
||||
$type = $data['type'] ?? 1;
|
||||
$price = $data['price'] ?? null;
|
||||
$sort = $data['sort'] ?? 1;
|
||||
if ($attr){
|
||||
$ids = $this->getAttrIds($attr);
|
||||
$build->whereIn('id',$ids);
|
||||
|
|
@ -88,12 +90,23 @@ class Api extends Backend
|
|||
$build->whereIn('series_id',$brand);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($price)){
|
||||
$prices = explode('-',$price);
|
||||
$build->whereBetween('price',$prices);
|
||||
}
|
||||
if (!empty($sort)){
|
||||
$sort = explode('-',$sort);
|
||||
$build->order($sort[0],$sort[1]);
|
||||
}else{
|
||||
$build->order('id','desc');
|
||||
}
|
||||
$build->where('car_type',$type);
|
||||
|
||||
$list = $build->paginate();
|
||||
|
||||
$res = [];
|
||||
$car_ids = [];
|
||||
|
||||
foreach ($list->items() as $item){
|
||||
$out = $item->toArray();
|
||||
$car_ids [] = $item['id'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user