土壤设备增加酸碱度
parent
5ce52144b3
commit
dfe788d7ea
|
|
@ -518,6 +518,21 @@ class DeviceController extends Controller
|
|||
'p',
|
||||
'k',
|
||||
];
|
||||
|
||||
switch ($device->supplier_key) {
|
||||
case 'device-supplier-biang':
|
||||
$fields = [
|
||||
'conductivity',
|
||||
'humidity',
|
||||
'temperature',
|
||||
'n',
|
||||
'p',
|
||||
'k',
|
||||
'ph',
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
/** @var \Illuminate\Support\Collection */
|
||||
$monitoringLogs = (
|
||||
$isSameDay
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class SoilMonitoringDailyLog extends Model
|
|||
'n',
|
||||
'p',
|
||||
'k',
|
||||
'ph',
|
||||
'moisture',
|
||||
'monitored_at',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class SoilMonitoringLog extends Model
|
|||
'n',
|
||||
'p',
|
||||
'k',
|
||||
'ph',
|
||||
'monitored_at',
|
||||
'moisture',
|
||||
'is_filled',
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ class BiAngDeviceService
|
|||
'soilConductivity' => 'conductivity',
|
||||
'soilTemperature' => 'temperature',
|
||||
'soilMoisture' => 'humidity',
|
||||
'soilPH' => 'ph',
|
||||
default => null,
|
||||
};
|
||||
|
||||
|
|
@ -418,6 +419,7 @@ class BiAngDeviceService
|
|||
'temperature' => ['sum' => 0, 'count' => 0],
|
||||
'humidity' => ['sum' => 0, 'count' => 0],
|
||||
'moisture' => ['sum' => 0, 'count' => 0],
|
||||
'ph' => ['sum' => 0, 'count' => 0],
|
||||
];
|
||||
|
||||
foreach ($soilReports as $soilReport) {
|
||||
|
|
|
|||
|
|
@ -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']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -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']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue