From ff775ec9d59293df43d867f019ee02a1ad6046ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Mon, 17 Jul 2023 12:00:06 +0800 Subject: [PATCH] Fix --- app/Services/DeviceLogService.php | 87 +++++++------------------------ 1 file changed, 19 insertions(+), 68 deletions(-) diff --git a/app/Services/DeviceLogService.php b/app/Services/DeviceLogService.php index 478f7cd..a345dd9 100644 --- a/app/Services/DeviceLogService.php +++ b/app/Services/DeviceLogService.php @@ -56,74 +56,25 @@ class DeviceLogService continue; } - if ($device->isTypeSoil()) { - // 如果包含气象设备监测字段,则跳过 - if (Arr::hasAny($item['data'], [ - 'day_rainfall', - 'accumulate_rainfall', - 'potassium_content', - 'moment_rainfall', - 'pm10_concentration', - 'pm25_concentration', - 'box_noise', - 'box_carbon', - 'box_humidity', - 'box_pressure', - 'box_temperature', - 'box_illumination', - 'wind_power', - 'wind_speed', - 'wind_degree', - 'wind_direction', - ])) { - continue; - } - } elseif ($device->isTypeMeteorological()) { - // 如果包含土壤设备监测字段,则跳过 - if (Arr::hasAny($item['data'], [ - 'nitrogen_content', - 'phosphorus_content', - 'potassium_content', - 'conductivity', - 'soil_humidity', - 'soil_temperature', - ])) { - continue; - } - } - - if ( - $device->isTypeSoil() && Arr::hasAny($item['data'], [ - - ]) - ) { - - } elseif ( - $device->isTypeMeteorological() && - Arr::hasAny( - $item['data'], - [ - 'nitrogen_content', - 'phosphorus_content', - 'potassium_content', - 'conductivity', - 'soil_humidity', - 'soil_temperature', - ] - ) - ) { - continue; - } - - $isSoilMonitoring = Arr::hasAny($item['data'], [ - 'soil_humidity', - 'soil_temperature', - 'nitrogen_content', - 'potassium_content', - 'phosphorus_content', - ]); - - if (($device->isTypeSoil() && ! $isSoilMonitoring) || (! $device->isTypeSoil() && $isSoilMonitoring)) { + // 如果多合一气象监测器包含土壤监控时,需过滤掉气象监控的数据 + if ($device->isTypeSoil() && Arr::hasAny($item['data'], [ + 'current_rainfall', + 'day_rainfall', + 'accumulate_rainfall', + 'moment_rainfall', + 'pm10_concentration', + 'pm25_concentration', + 'box_illumination', + 'box_pressure', + 'box_carbon', + 'box_temperature', + 'box_humidity', + 'box_noise', + 'wind_degree', + 'wind_direction', + 'wind_power', + 'wind_speed', + ])) { continue; }