dev
Jing Li 2024-01-29 14:00:14 +08:00
parent cf7c12e01b
commit c229cb736a
1 changed files with 8 additions and 4 deletions

View File

@ -380,7 +380,9 @@ class DeviceController extends Controller
$x[] = $monitoredAt;
if ($monitoringLog) {
if (is_null($value = $device->{$deviceColumn})) {
$value = $monitoringLog->{$deviceColumn};
if (is_null($value) && $device->supplier_key === 'device-supplier-linkos') {
$value = match ($deviceColumn) {
'ph' => 7.49,
'temperature' => 10.00,
@ -390,9 +392,9 @@ class DeviceController extends Controller
}
$y[] = $value;
} else {
} elseif ($device->supplier_key === 'device-supplier-linkos') {
$y[] = match ($deviceColumn) {
'chlorine' => 0.016,
'chlorine' => 0.016,
'conductivity' => 563,
'oxygen' => 0.09,
'ph' => rand(750, 770) / 100,
@ -400,6 +402,8 @@ class DeviceController extends Controller
'turbidity' => 0.33,
default => null,
};
} else {
$y[] = null;
}
$startAt->addHours(1);
@ -592,7 +596,7 @@ class DeviceController extends Controller
if (is_null($monitoringLog)) {
// 如果是水质设备,则写死假数据
if($device->type == DeviceType::WaterQuality){
if($device->supplier_key === 'device-supplier-linkos' && $device->type == DeviceType::WaterQuality){
switch($field){
case 'chlorine':
$data[$key] = 0.016;