比昂水质设备
parent
547f0796ba
commit
da004b5674
|
|
@ -37,7 +37,7 @@ class HttpClient
|
|||
public function getLatestWaterDeviceReport(string $deviceId)
|
||||
{
|
||||
$result = $this->get(
|
||||
$this->apiUrl('/api/open-api/open/getWaterDeviceData'),
|
||||
$this->apiUrl('/api/open-api/open/getCurrentWaterData'),
|
||||
[
|
||||
'deviceId' => $deviceId,
|
||||
]
|
||||
|
|
|
|||
|
|
@ -152,9 +152,11 @@ class BiAngDeviceService
|
|||
if (is_array($data = $log->data)) {
|
||||
foreach ($data as $k => $v) {
|
||||
$attribute = match ($k) {
|
||||
'ec1' => 'conductivity',
|
||||
'waterdo' => 'oxygen',
|
||||
'zd' => 'turbidity',
|
||||
'waterMlss' => 'turbidity',
|
||||
'waterPh' => 'ph',
|
||||
'waterDo' => 'oxygen',
|
||||
'waterTemp' => 'temperature',
|
||||
'waterNh3n' => 'nh3n',
|
||||
default => null,
|
||||
};
|
||||
|
||||
|
|
@ -474,6 +476,7 @@ class BiAngDeviceService
|
|||
'ph' => ['sum' => 0, 'count' => 0],
|
||||
'temperature' => ['sum' => 0, 'count' => 0],
|
||||
'turbidity' => ['sum' => 0, 'count' => 0],
|
||||
'nh3n' => ['sum' => 0, 'count' => 0],
|
||||
];
|
||||
|
||||
foreach ($waterQualityReports as $waterQualityReport) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('water_quality_monitoring_logs', function (Blueprint $table) {
|
||||
$table->decimal('nh3n', 8, 2)->nullable()->comment('氨氮 (mg/L)');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('water_quality_monitoring_logs', function (Blueprint $table) {
|
||||
$table->dropColumn(['nh3n']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('water_quality_monitoring_daily_logs', function (Blueprint $table) {
|
||||
$table->decimal('nh3n', 8, 2)->nullable()->comment('氨氮 (mg/L)');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('water_quality_monitoring_daily_logs', function (Blueprint $table) {
|
||||
$table->dropColumn(['nh3n']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue