优化同步 linkos 历史流水
parent
2660bd86bc
commit
6654d00ee3
|
|
@ -69,4 +69,9 @@ class Device extends Model
|
|||
{
|
||||
return $this->type === static::TYPE_SOIL;
|
||||
}
|
||||
|
||||
public function isTypeMeteorological(): bool
|
||||
{
|
||||
return $this->type === static::TYPE_METEOROLOGICAL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,65 @@ 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',
|
||||
|
|
|
|||
Loading…
Reference in New Issue