无法正确获取到价格时的处理

This commit is contained in:
iVampireSP.com 2022-08-27 16:33:08 +08:00
parent 5b9451da8b
commit fb54290491
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -47,7 +47,12 @@ public function handle()
// dd($response);
$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();