Fix
parent
9b6581cdce
commit
b18925675c
|
|
@ -246,37 +246,41 @@ class DeviceController extends Controller
|
|||
}
|
||||
for ($i = 5; $i >= 0; $i--) {
|
||||
$_key = now()->subHours($i)->format('Y-m-d H').':00:00';
|
||||
$data[$device->monitoring_point][$_key] = null;
|
||||
if (isset($_dataList[$_key])) {
|
||||
if($deviceColumn == 'ph'){
|
||||
$data[$device->monitoring_point][$_key] = 7.49;
|
||||
}elseif($deviceColumn == 'temperature'){
|
||||
$data[$device->monitoring_point][$_key] = 10.00;
|
||||
}elseif($deviceColumn == 'turbidity'){
|
||||
$data[$device->monitoring_point][$_key] = 1028.60;
|
||||
}else{
|
||||
$data[$device->monitoring_point][$_key] = $_dataList[$_key][$deviceColumn] ?? null;
|
||||
}
|
||||
}else{//临时写一些假数据
|
||||
switch($deviceColumn){
|
||||
case 'chlorine':
|
||||
$data[$device->monitoring_point][$_key] = 0.016;
|
||||
break;
|
||||
case 'conductivity':
|
||||
$data[$device->monitoring_point][$_key] = 563 ;//电导率
|
||||
break;
|
||||
case 'oxygen':
|
||||
$data[$device->monitoring_point][$_key] = 0.09;//含氧量
|
||||
break;
|
||||
case 'ph':
|
||||
$data[$device->monitoring_point][$_key] = rand(750, 770) / 100;
|
||||
break;
|
||||
case 'temperature':
|
||||
$data[$device->monitoring_point][$_key] = rand(950, 1050) / 100;
|
||||
break;
|
||||
case 'turbidity':
|
||||
$data[$device->monitoring_point][$_key] = 0.33;
|
||||
break;
|
||||
|
||||
$data[$device->monitoring_point][$_key] = $_dataList[$_key][$deviceColumn] ?? null;
|
||||
|
||||
if ($device->supplier_key === 'device-supplier-linkos') {
|
||||
if (isset($_dataList[$_key])) {
|
||||
if($deviceColumn == 'ph'){
|
||||
$data[$device->monitoring_point][$_key] = 7.49;
|
||||
}elseif($deviceColumn == 'temperature'){
|
||||
$data[$device->monitoring_point][$_key] = 10.00;
|
||||
}elseif($deviceColumn == 'turbidity'){
|
||||
$data[$device->monitoring_point][$_key] = 1028.60;
|
||||
}else{
|
||||
$data[$device->monitoring_point][$_key] = $_dataList[$_key][$deviceColumn] ?? null;
|
||||
}
|
||||
}else{//临时写一些假数据
|
||||
switch($deviceColumn){
|
||||
case 'chlorine':
|
||||
$data[$device->monitoring_point][$_key] = 0.016;
|
||||
break;
|
||||
case 'conductivity':
|
||||
$data[$device->monitoring_point][$_key] = 563 ;//电导率
|
||||
break;
|
||||
case 'oxygen':
|
||||
$data[$device->monitoring_point][$_key] = 0.09;//含氧量
|
||||
break;
|
||||
case 'ph':
|
||||
$data[$device->monitoring_point][$_key] = rand(750, 770) / 100;
|
||||
break;
|
||||
case 'temperature':
|
||||
$data[$device->monitoring_point][$_key] = rand(950, 1050) / 100;
|
||||
break;
|
||||
case 'turbidity':
|
||||
$data[$device->monitoring_point][$_key] = 0.33;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue