土壤设备增加酸碱度

main
Jing Li 2024-06-02 13:15:36 +08:00
parent 5ce52144b3
commit dfe788d7ea
6 changed files with 83 additions and 0 deletions

View File

@ -518,6 +518,21 @@ class DeviceController extends Controller
'p', 'p',
'k', 'k',
]; ];
switch ($device->supplier_key) {
case 'device-supplier-biang':
$fields = [
'conductivity',
'humidity',
'temperature',
'n',
'p',
'k',
'ph',
];
break;
}
/** @var \Illuminate\Support\Collection */ /** @var \Illuminate\Support\Collection */
$monitoringLogs = ( $monitoringLogs = (
$isSameDay $isSameDay

View File

@ -22,6 +22,7 @@ class SoilMonitoringDailyLog extends Model
'n', 'n',
'p', 'p',
'k', 'k',
'ph',
'moisture', 'moisture',
'monitored_at', 'monitored_at',
]; ];

View File

@ -27,6 +27,7 @@ class SoilMonitoringLog extends Model
'n', 'n',
'p', 'p',
'k', 'k',
'ph',
'monitored_at', 'monitored_at',
'moisture', 'moisture',
'is_filled', 'is_filled',

View File

@ -99,6 +99,7 @@ class BiAngDeviceService
'soilConductivity' => 'conductivity', 'soilConductivity' => 'conductivity',
'soilTemperature' => 'temperature', 'soilTemperature' => 'temperature',
'soilMoisture' => 'humidity', 'soilMoisture' => 'humidity',
'soilPH' => 'ph',
default => null, default => null,
}; };
@ -418,6 +419,7 @@ class BiAngDeviceService
'temperature' => ['sum' => 0, 'count' => 0], 'temperature' => ['sum' => 0, 'count' => 0],
'humidity' => ['sum' => 0, 'count' => 0], 'humidity' => ['sum' => 0, 'count' => 0],
'moisture' => ['sum' => 0, 'count' => 0], 'moisture' => ['sum' => 0, 'count' => 0],
'ph' => ['sum' => 0, 'count' => 0],
]; ];
foreach ($soilReports as $soilReport) { foreach ($soilReports as $soilReport) {

View File

@ -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('soil_monitoring_logs', function (Blueprint $table) {
$table->decimal('ph', 4, 2)->nullable()->comment('酸碱度');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('soil_monitoring_logs', function (Blueprint $table) {
$table->dropColumn(['ph']);
});
}
};

View File

@ -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('soil_monitoring_daily_logs', function (Blueprint $table) {
$table->decimal('ph', 4, 2)->nullable()->comment('酸碱度');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('soil_monitoring_daily_logs', function (Blueprint $table) {
$table->dropColumn(['ph']);
});
}
};