From fb54290491ffe5d8f3b0ef85e6135ccceda7480a Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sat, 27 Aug 2022 16:33:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=88=B0=E4=BB=B7=E6=A0=BC=E6=97=B6=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Jobs/Remote/PushHost.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Remote/PushHost.php b/app/Jobs/Remote/PushHost.php index 41c414f..d1263c2 100644 --- a/app/Jobs/Remote/PushHost.php +++ b/app/Jobs/Remote/PushHost.php @@ -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();