From 31f0c0a88b06f1fccadbb7d1cce04f4007523026 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Sat, 12 Aug 2023 12:51:10 +0800 Subject: [PATCH] Update --- app/Models/InsecticidalLampReport.php | 1 + app/Services/BiAngDeviceLogService.php | 1 + .../2023_08_11_172337_create_insecticidal_lamp_reports_table.php | 1 + 3 files changed, 3 insertions(+) diff --git a/app/Models/InsecticidalLampReport.php b/app/Models/InsecticidalLampReport.php index 99c5b22..7e4e87f 100644 --- a/app/Models/InsecticidalLampReport.php +++ b/app/Models/InsecticidalLampReport.php @@ -15,6 +15,7 @@ class InsecticidalLampReport extends Model protected $fillable = [ 'device_id', + 'agricultural_base_id', 'battery_vol', 'killed_num', 'air_temperature', diff --git a/app/Services/BiAngDeviceLogService.php b/app/Services/BiAngDeviceLogService.php index 5e6470b..292aa8c 100644 --- a/app/Services/BiAngDeviceLogService.php +++ b/app/Services/BiAngDeviceLogService.php @@ -64,6 +64,7 @@ class BiAngDeviceLogService 'device_id' => $device->id, 'reported_at' => $syncTime->startOfHour(), ], [ + 'agricultural_base_id' => $device->agricultural_base_id, 'battery_vol' => $data['vol'], 'killed_num' => $data['dct'], 'air_temperature' => $data['temp'], diff --git a/database/migrations/2023_08_11_172337_create_insecticidal_lamp_reports_table.php b/database/migrations/2023_08_11_172337_create_insecticidal_lamp_reports_table.php index 518eed1..c8aaeba 100644 --- a/database/migrations/2023_08_11_172337_create_insecticidal_lamp_reports_table.php +++ b/database/migrations/2023_08_11_172337_create_insecticidal_lamp_reports_table.php @@ -16,6 +16,7 @@ return new class extends Migration Schema::create('insecticidal_lamp_reports', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('device_id'); + $table->unsignedBigInteger('agricultural_base_id')->comment('农业基地ID'); $table->double('battery_vol')->nullable()->comment('蓄电池电压'); $table->unsignedInteger('killed_num')->default(0)->comment('杀虫树'); $table->double('air_temperature')->nullable()->comment('大气气温');