api
This commit is contained in:
parent
ac924a4613
commit
47f4c127ae
|
|
@ -76,7 +76,7 @@ class Api extends Backend
|
||||||
$build = Cars::where('is_active',1);
|
$build = Cars::where('is_active',1);
|
||||||
$attr = $data['attr'] ?? null;
|
$attr = $data['attr'] ?? null;
|
||||||
$brand = $data['brand'] ?? null;
|
$brand = $data['brand'] ?? null;
|
||||||
$type = $data['type'] ?? 1;
|
$type = request()->request('type') ?? 1;
|
||||||
if ($attr){
|
if ($attr){
|
||||||
$ids = $this->getAttrIds($attr);
|
$ids = $this->getAttrIds($attr);
|
||||||
$build->whereIn('id',$ids);
|
$build->whereIn('id',$ids);
|
||||||
|
|
@ -88,6 +88,7 @@ class Api extends Backend
|
||||||
$build->whereIn('series_id',$brand);
|
$build->whereIn('series_id',$brand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$build->where('car_type',$type);
|
$build->where('car_type',$type);
|
||||||
$list = $build->paginate();
|
$list = $build->paginate();
|
||||||
|
|
||||||
|
|
@ -96,11 +97,13 @@ class Api extends Backend
|
||||||
foreach ($list->items() as $item){
|
foreach ($list->items() as $item){
|
||||||
$out = $item->toArray();
|
$out = $item->toArray();
|
||||||
$car_ids [] = $item['id'];
|
$car_ids [] = $item['id'];
|
||||||
|
if ($out['cover_image']){
|
||||||
$images = explode(',',$out['cover_image']);
|
$images = explode(',',$out['cover_image']);
|
||||||
$images = array_map(function($url) {
|
$images = array_map(function($url) {
|
||||||
return cdnurl($url, true); // true 表示生成绝对路径
|
return cdnurl($url, true); // true 表示生成绝对路径
|
||||||
}, $images);
|
}, $images);
|
||||||
$out['cover_image'] = $images;
|
$out['cover_image'] = $images;
|
||||||
|
}
|
||||||
$res [] = $out;
|
$res [] = $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user