网站车辆筛选
This commit is contained in:
@@ -41,7 +41,7 @@ class BrandController extends BaseController
|
||||
*/
|
||||
protected function postProcessItem(array $item, string $scene): array
|
||||
{
|
||||
if ($scene === 'default' || $scene === 'letter' || $scene === 'hot') {
|
||||
if ($scene === 'default' || $scene === 'letter' || $scene === 'hot' || $scene === 'show') {
|
||||
$result = [
|
||||
'id' => $item['id'],
|
||||
'status' => $item['status'],
|
||||
@@ -107,7 +107,7 @@ class BrandController extends BaseController
|
||||
$params['filters'][] = ['field' => 'is_hot', 'operator' => '=', 'value' => 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
@@ -141,4 +141,20 @@ class BrandController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param Request $request 请求对象
|
||||
* @return Response 响应对象
|
||||
*/
|
||||
public function detail(Request $request, int $id, string $scene = 'show'): Response
|
||||
{
|
||||
try {
|
||||
$request->setGet(['id'=>$id]);
|
||||
return parent::one($request, $scene);
|
||||
} catch (\Throwable $th) {
|
||||
return $this->errorResponse($th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class BrandService extends BaseService
|
||||
],
|
||||
];
|
||||
},
|
||||
'hot' => function ($params) {
|
||||
'show' => function ($params) {
|
||||
return [
|
||||
'filters' => [
|
||||
['field' => 'status', 'operator' => '=', 'value' => '1'],
|
||||
@@ -69,7 +69,11 @@ class BrandService extends BaseService
|
||||
],
|
||||
'fields' => ['id', 'status', 'sort', 'toppic', 'descpic', 'logo', 'letter', 'is_hot', 'created_at', 'updated_at'],
|
||||
'relations' => [
|
||||
'translation' => ['brand_id', 'name']
|
||||
'translation' => ['brand_id', 'name', 'desc','toppic_alt','descpic_alt','logo_alt'],
|
||||
'banners' => ['id', 'pic', 'sort',],
|
||||
'banners.translation' => ['id', 'alt',],
|
||||
'traits' => ['id', 'sort',],
|
||||
'traits.translation' => ['id', 'title', 'content',],
|
||||
],
|
||||
'sorts' => [
|
||||
['field' => 'id', 'direction' => 'desc']
|
||||
|
||||
@@ -29,9 +29,7 @@ class VehicleNewService extends BaseService
|
||||
'default' => function ($params) {
|
||||
$keyword = $params['keyword'] ?? '';
|
||||
return [
|
||||
'filters' => [
|
||||
// ['field' => '***', 'operator' => '=', 'value' => '***']
|
||||
],
|
||||
'filters' => $params['filters'],
|
||||
'fields' => ['id', 'vin', 'brand', 'cover', 'price', 'type', 'energy', 'model', 'video', 'views', 'created_at', 'updated_at'],
|
||||
'relations' => [
|
||||
'translation' => ['vehicle_id', 'locale', 'name', 'condition_desc', 'location'],
|
||||
|
||||
+4
-4
@@ -42,11 +42,11 @@ Route::group('/apis', function() {
|
||||
Route::any('/agt/privacy', [\app\apis\controller\AgreementController::class, 'one']);
|
||||
// 品牌按字母查询
|
||||
Route::any('/brand/letterAll', [\app\apis\controller\BrandController::class, 'letterAll']);
|
||||
// 品牌按字母查询
|
||||
Route::any('/brand/detail', [\app\apis\controller\BrandController::class, 'detail']);
|
||||
// 品牌详情
|
||||
Route::any('/brand/detail/{id}', [\app\apis\controller\BrandController::class, 'detail']);
|
||||
// 新车管理
|
||||
Route::any('/vehicle/new/list', [\app\console\controller\VehicleNewController::class, 'index']);
|
||||
Route::any('/vehicle/new/{id}/detail', [\app\console\controller\VehicleNewController::class, 'detail']);
|
||||
Route::any('/vehicle/new/list', [\app\apis\controller\VehicleNewController::class, 'index']);
|
||||
Route::any('/vehicle/new/{id}/detail', [\app\apis\controller\VehicleNewController::class, 'detail']);
|
||||
// 能源列表
|
||||
Route::any('/energy/preset', [\app\console\controller\EnergyController::class, 'presets']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user