Compare commits
No commits in common. "dd2b56a0d2af5c7eaeb927b69cde1744d9913cc1" and "df71aeb9459fd20f70f36e000fff16698a93885d" have entirely different histories.
dd2b56a0d2
...
df71aeb945
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Enums;
|
|
||||||
|
|
||||||
enum WindDirection: int
|
|
||||||
{
|
|
||||||
case North = 0; // 北风
|
|
||||||
case Northeast = 1; // 东北风;
|
|
||||||
case East = 2; // 东风
|
|
||||||
case Southeast = 3; // 东南风
|
|
||||||
case South = 4; // 南方
|
|
||||||
case Southwest = 5; // 西南风
|
|
||||||
case West = 6; // 西风
|
|
||||||
case Northwest = 7; // 西北风
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use App\Enums\WindDirection;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class MeteorologicalMonitoringLog extends Model
|
|
||||||
{
|
|
||||||
use HasFactory;
|
|
||||||
|
|
||||||
protected $casts = [
|
|
||||||
'wind_direction' => WindDirection::class,
|
|
||||||
'monitored_at' => 'datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'device_id',
|
|
||||||
'agricultural_base_id',
|
|
||||||
'wind_speed',
|
|
||||||
'wind_power',
|
|
||||||
'wind_direction',
|
|
||||||
'wind_degree',
|
|
||||||
'air_humidity',
|
|
||||||
'air_temperature',
|
|
||||||
'air_pressure',
|
|
||||||
'co2',
|
|
||||||
'noise',
|
|
||||||
'illumination',
|
|
||||||
'accumulated_rainfall',
|
|
||||||
'current_rainfall',
|
|
||||||
'moment_rainfall',
|
|
||||||
'day_rainfall',
|
|
||||||
'pm25',
|
|
||||||
'pm10',
|
|
||||||
'monitored_at',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class SoilMonitoringLog extends Model
|
|
||||||
{
|
|
||||||
use HasFactory;
|
|
||||||
|
|
||||||
protected $casts = [
|
|
||||||
'monitored_at' => 'datetime',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'device_id',
|
|
||||||
'agricultural_base_id',
|
|
||||||
'conductivity',
|
|
||||||
'humidity',
|
|
||||||
'temperature',
|
|
||||||
'n',
|
|
||||||
'p',
|
|
||||||
'k',
|
|
||||||
'monitored_at',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
<?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::create('soil_monitoring_logs', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->unsignedBigInteger('device_id')->comment('设备ID');
|
|
||||||
$table->unsignedBigInteger('agricultural_base_id')->comment('农业基地ID');
|
|
||||||
$table->decimal('conductivity', 8, 2)->nullable()->comment('电导率 (单位: us/cm)');
|
|
||||||
$table->decimal('humidity', 8, 2)->nullable()->comment('湿度 (单位: %RH)');
|
|
||||||
$table->decimal('temperature', 8, 2)->nullable()->comment('温度 (单位: ℃)');
|
|
||||||
$table->integer('n')->nullable()->comment('氮 (单位: mg/kg)');
|
|
||||||
$table->integer('p')->nullable()->comment('磷 (单位: mg/kg)');
|
|
||||||
$table->integer('k')->nullable()->comment('钾 (单位: mg/kg)');
|
|
||||||
$table->timestamp('monitored_at')->comment('监控时间(小时)');
|
|
||||||
$table->timestamps();
|
|
||||||
|
|
||||||
// 索引
|
|
||||||
$table->index('device_id');
|
|
||||||
$table->index('agricultural_base_id');
|
|
||||||
$table->unique('monitored_at');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('soil_monitoring_logs');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
<?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::create('meteorological_monitoring_logs', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->unsignedBigInteger('device_id')->comment('设备ID');
|
|
||||||
$table->unsignedBigInteger('agricultural_base_id')->comment('农业基地ID');
|
|
||||||
$table->decimal('wind_speed', 8, 2)->nullable()->comment('风速 (单位: m/s)');
|
|
||||||
$table->integer('wind_power')->nullable()->comment('风力');
|
|
||||||
$table->tinyInteger('wind_direction')->nullable()->comment('风向: 0 北风, 1 东北风, 2 东风, 3 东南风, 4 南风, 5 西南风, 6 西风, 7 西北风');
|
|
||||||
$table->integer('wind_degree')->nullable()->comment('风向度数');
|
|
||||||
$table->decimal('air_humidity', 8, 2)->nullable()->comment('空气湿度 (单位: db)');
|
|
||||||
$table->decimal('air_temperature', 8, 2)->nullable()->comment('气温 (单位: db)');
|
|
||||||
$table->decimal('air_pressure', 8, 2)->nullable()->comment('气压 (单位: Kpa)');
|
|
||||||
$table->decimal('co2', 8, 2)->nullable()->comment('二氧化碳浓度 (单位: ppm)');
|
|
||||||
$table->decimal('noise', 8, 2)->nullable()->comment('噪声 (单位: db)');
|
|
||||||
$table->integer('illumination')->nullable()->comment('光照度 (单位: Lux)');
|
|
||||||
$table->decimal('accumulated_rainfall', 8, 2)->nullable()->comment('积雨量 (单位: mm)');
|
|
||||||
$table->decimal('current_rainfall', 8, 2)->nullable()->comment('当前雨量 (单位: mm)');
|
|
||||||
$table->decimal('moment_rainfall', 8, 2)->nullable()->comment('瞬时雨量 (单位: mm)');
|
|
||||||
$table->decimal('day_rainfall', 8, 2)->nullable()->comment('日雨量 (单位: mm)');
|
|
||||||
$table->integer('pm25')->nullable()->comment('PM2.5浓度 (单位: ug/m3)');
|
|
||||||
$table->integer('pm10')->nullable()->comment('PM10浓度 (单位: ug/m3)');
|
|
||||||
$table->timestamp('monitored_at')->comment('监控时间(小时)');
|
|
||||||
$table->timestamps();
|
|
||||||
|
|
||||||
// 索引
|
|
||||||
$table->index('device_id');
|
|
||||||
$table->index('agricultural_base_id');
|
|
||||||
$table->unique('monitored_at');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('meteorological_monitoring_logs');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Loading…
Reference in New Issue