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; }