无法正确获取到价格时的处理
This commit is contained in:
parent
5b9451da8b
commit
fb54290491
@ -47,7 +47,12 @@ public function handle()
|
|||||||
// dd($response);
|
// dd($response);
|
||||||
$response_json = $response->json();
|
$response_json = $response->json();
|
||||||
|
|
||||||
$host->price = $response_json['data']['price'];
|
// 检测是否有价格
|
||||||
|
if (isset($response_json['price'])) {
|
||||||
|
$host->price = $response_json['price'];
|
||||||
|
} else {
|
||||||
|
$host->status = 'error';
|
||||||
|
}
|
||||||
|
|
||||||
$host->save();
|
$host->save();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user