抓取车辆
This commit is contained in:
@@ -40,7 +40,7 @@ class UsedCar extends Model
|
||||
/**
|
||||
* 允许自动填充模型字段
|
||||
*/
|
||||
protected $fillable = ['id', 'user_id', 'product_name', 'vin', 'price', 'source_place', 'plate_place', 'plate_time', 'displacement','mileage', 'body_color', 'images', 'condition_desc', 'status', 'sort', 'created_at', 'updated_at'];
|
||||
protected $fillable = ['id', 'user_id', 'product_name', 'vin', 'price', 'source_place', 'plate_place', 'plate_time', 'displacement','mileage','power', 'body_color', 'images', 'condition_desc', 'crawl_title', 'crawl_brand', 'crawl_series', 'crawl_year', 'crawl_msrp', 'crawl_car_id', 'status', 'sort', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* 不允许自动填充模型字段
|
||||
|
||||
@@ -40,8 +40,9 @@ class AuthService
|
||||
$noncestr = $this->generateNonceStr();
|
||||
|
||||
// 获取毫秒级时间戳
|
||||
$timestamp = (int)round(microtime(true) * 1000);
|
||||
|
||||
//$timestamp = (int)round(microtime(true) * 1000);
|
||||
$timestamp = (int)time();
|
||||
|
||||
// 拼接签名字符串
|
||||
$verifyStr = "jsapi_ticket={$jsapiTicket}&noncestr={$noncestr}×tamp={$timestamp}&url={$url}";
|
||||
|
||||
|
||||
@@ -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