Update
parent
2cbf5314a5
commit
6cbb8c0336
|
|
@ -92,6 +92,11 @@ class DeviceLogSyncCommand extends Command
|
|||
case DeviceType::Soil:
|
||||
$data = $httpClient->getLatestSoilReport($device->sn);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->warn('设备数据为空');
|
||||
break;
|
||||
}
|
||||
|
||||
$log = DeviceLog::firstOrCreate([
|
||||
'device_id' => $device->id,
|
||||
'reported_at' => $data['time'],
|
||||
|
|
@ -107,6 +112,11 @@ class DeviceLogSyncCommand extends Command
|
|||
case DeviceType::Meteorological:
|
||||
$data = $httpClient->getLatestMeteorologicalReport($device->sn);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->warn('设备数据为空');
|
||||
break;
|
||||
}
|
||||
|
||||
$log = DeviceLog::firstOrCreate([
|
||||
'device_id' => $device->id,
|
||||
'reported_at' => $data['time'],
|
||||
|
|
@ -122,6 +132,11 @@ class DeviceLogSyncCommand extends Command
|
|||
case DeviceType::InsecticidalLamp:
|
||||
$data = $httpClient->getLatestLampReport($device->sn);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->warn('设备数据为空');
|
||||
break;
|
||||
}
|
||||
|
||||
$log = DeviceLog::firstOrCreate([
|
||||
'device_id' => $device->id,
|
||||
'reported_at' => $data['time'],
|
||||
|
|
@ -142,6 +157,11 @@ class DeviceLogSyncCommand extends Command
|
|||
|
||||
$data = $httpClient->getWormPhotos($device->sn, $now->copy()->subHours(24), $now);
|
||||
|
||||
if (empty($data)) {
|
||||
$this->warn('设备数据为空');
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($data['imgUrl'] as $item) {
|
||||
// 下载图片
|
||||
$name = md5($item['url']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue