dev
parent
b86efdc00b
commit
29e4660cf6
|
|
@ -176,10 +176,33 @@ class BiAngDeviceLogService
|
|||
};
|
||||
|
||||
if ($attribute) {
|
||||
if ($attribute == 'moment_rainfall') {
|
||||
$attributes[$attribute] = bcadd($attributes[$attribute] ?? '0.00', $v, 2);
|
||||
} else {
|
||||
$attributes[$attribute] = $v;
|
||||
switch ($attribute) {
|
||||
case 'moment_rainfall':
|
||||
$attributes[$attribute] = bcadd($attributes[$attribute] ?? '0.00', $v, 2);
|
||||
break;
|
||||
|
||||
case 'wind_degree':
|
||||
$attributes[$attribute] = value(function ($v) {
|
||||
if ($v >= 22.5 && $v < 67.5) {
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_NORTHEAST;
|
||||
} elseif ($v >= 67.5 && $v < 112.5) {
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_EAST;
|
||||
} elseif ($v >= 112.5 && $v < 157.5) {
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_SOUTHEAST;
|
||||
} elseif ($v >= 157.5 && $v < 202.5) {
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_SOUTH;
|
||||
} elseif ($v >= 202.5 && $v < 247.5) {
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_SOUTHWEST;
|
||||
} elseif ($v >= 247.5 && $v < 292.5) {
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_WEST;
|
||||
} elseif ($v >= 292.5 && $v < 337.5) {
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_NORTHWEST;
|
||||
}
|
||||
return MeteorologicalMonitoringDailyLog::WIND_DIRECTION_NORTH;
|
||||
}, $v);
|
||||
default:
|
||||
$attributes[$attribute] = $v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue