api
This commit is contained in:
parent
4ff7c0c2c5
commit
ac924a4613
|
|
@ -76,6 +76,7 @@ class Api extends Backend
|
|||
$build = Cars::where('is_active',1);
|
||||
$attr = $data['attr'] ?? null;
|
||||
$brand = $data['brand'] ?? null;
|
||||
$type = $data['type'] ?? 1;
|
||||
if ($attr){
|
||||
$ids = $this->getAttrIds($attr);
|
||||
$build->whereIn('id',$ids);
|
||||
|
|
@ -87,7 +88,7 @@ class Api extends Backend
|
|||
$build->whereIn('series_id',$brand);
|
||||
}
|
||||
}
|
||||
|
||||
$build->where('car_type',$type);
|
||||
$list = $build->paginate();
|
||||
|
||||
$res = [];
|
||||
|
|
@ -145,6 +146,16 @@ class Api extends Backend
|
|||
}
|
||||
|
||||
|
||||
public function banners()
|
||||
{
|
||||
$banner = config('site.banner_images'); // 获取轮播图数组
|
||||
$out = [];
|
||||
foreach ($banner as $item){
|
||||
$out [] = cdnurl($item);
|
||||
}
|
||||
return $this->return_json($out);
|
||||
}
|
||||
|
||||
public function carInfo()
|
||||
{
|
||||
$id = request()->get('id');
|
||||
|
|
@ -196,7 +207,7 @@ class Api extends Backend
|
|||
}
|
||||
|
||||
|
||||
function mapAllCarAttributesSorted(array $carAttributes, array $attributeDefs): array
|
||||
private function mapAllCarAttributesSorted(array $carAttributes, array $attributeDefs): array
|
||||
{
|
||||
// 把属性定义按 id 映射为键,并附带 sort_order
|
||||
$defMap = [];
|
||||
|
|
@ -295,4 +306,7 @@ class Api extends Backend
|
|||
|
||||
return array_values(array_unique($car_id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,4 +37,10 @@ return [
|
|||
'mail_smtp_pass' => '',
|
||||
'mail_verify_type' => '2',
|
||||
'mail_from' => '',
|
||||
'banner_images' =>
|
||||
array (
|
||||
0 => '/uploads/20250703/82272df33cf8371e2940dba294bd43f1.jpg',
|
||||
1 => '/uploads/20250703/d06c0bbb2f14aae32d33d2c64d92e431.jpg',
|
||||
2 => '/uploads/20250703/054c53776891b766c6f1bd65059a5b27.jpg',
|
||||
),
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user