抓取车辆
This commit is contained in:
@@ -127,20 +127,22 @@ class UsedCarService
|
||||
throw new \Exception('抓取失败,未找到该系列车型');
|
||||
}
|
||||
|
||||
$brandSerieses = [];
|
||||
if(empty($seriesId) && !empty($crawlSeries) || count($crawlSeries)>1){ //关键词为品牌名时抓取所有车系的懂车帝id
|
||||
$href = $crawlService->modelSearch($crawlSeries[0]);
|
||||
$seriesId = $this->extractSeriesId($href); //懂车帝车系id
|
||||
//抓取品牌与系列
|
||||
$brandSeries = $crawlService->crawlBrandSeries($seriesId);
|
||||
foreach ($crawlSeries as $item) {
|
||||
// $brandSerieses[] = $crawlService->brandSeries($keyword);
|
||||
$brandSerieses[] = ['brand' => $brandSeries['brand'], 'series' => $item];
|
||||
}
|
||||
}elseif (!empty($seriesId) && empty($crawlSeries)){
|
||||
//抓取品牌与系列
|
||||
$brandSerieses[] = $crawlService->crawlBrandSeries($seriesId);
|
||||
}
|
||||
// $brandSerieses = [];
|
||||
// if(empty($seriesId) && !empty($crawlSeries) || count($crawlSeries)>1){ //关键词为品牌名时抓取所有车系的懂车帝id
|
||||
// $href = $crawlService->modelSearch($crawlSeries[0]);
|
||||
// $seriesId = $this->extractSeriesId($href); //懂车帝车系id
|
||||
// //抓取品牌与系列
|
||||
// $brandSeries = $crawlService->crawlBrandSeries($seriesId);
|
||||
// foreach ($crawlSeries as $item) {
|
||||
//// $brandSerieses[] = $crawlService->brandSeries($keyword);
|
||||
// $brandSerieses[] = ['brand' => $brandSeries['brand'], 'series' => $item];
|
||||
// }
|
||||
// }elseif (!empty($seriesId) && empty($crawlSeries)){
|
||||
// //抓取品牌与系列
|
||||
// $brandSerieses[] = $crawlService->crawlBrandSeries($seriesId);
|
||||
// }
|
||||
//抓取品牌与系列
|
||||
$brandSerieses[] = $crawlService->crawlBrandSeries($seriesId);
|
||||
|
||||
$result = [];
|
||||
try {
|
||||
@@ -206,7 +208,9 @@ class UsedCarService
|
||||
}
|
||||
$models[$key] = [
|
||||
'title' => $model["info"]['year'] . '款 ' .$model["info"]['car_name'],
|
||||
'brand_id' => $model["info"]['brand_id'],
|
||||
'brand_name' => $model["info"]['brand_name'],
|
||||
'series_id' => $model["info"]['series_id'],
|
||||
'series_name' => $model["info"]['series_name'],
|
||||
'year' => $model["info"]['year'],
|
||||
'msrp' => $official_price,
|
||||
|
||||
Reference in New Issue
Block a user