refactor: remove syncing
This commit is contained in:
@@ -30,12 +30,6 @@ class TerminalFactory extends Factory
|
||||
'ip_address' => fake()->localIpv4(),
|
||||
'station_id' => null, // 需要关联实际的线站ID
|
||||
'diagram_url' => fake()->imageUrl(1920, 1080, 'diagram', true),
|
||||
'display_config' => [
|
||||
'resolution' => fake()->randomElement(['1920x1080', '2560x1440', '3840x2160']),
|
||||
'refresh_rate' => fake()->randomElement([30, 60, 120]),
|
||||
'orientation' => fake()->randomElement(['landscape', 'portrait']),
|
||||
'brightness' => fake()->numberBetween(50, 100),
|
||||
],
|
||||
'is_online' => fake()->boolean(70), // 70%概率在线
|
||||
'last_online_at' => fake()->dateTimeBetween('-7 days', 'now'),
|
||||
];
|
||||
@@ -63,21 +57,6 @@ class TerminalFactory extends Factory
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定终端为高分辨率配置
|
||||
*/
|
||||
public function highResolution(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'display_config' => [
|
||||
'resolution' => '3840x2160',
|
||||
'refresh_rate' => 60,
|
||||
'orientation' => 'landscape',
|
||||
'brightness' => 80,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定终端为生产线终端
|
||||
*/
|
||||
|
||||
@@ -16,9 +16,11 @@ return new class extends Migration
|
||||
$table->string('name')->comment('终端名称');
|
||||
$table->string('code', 100)->unique()->comment('终端编码');
|
||||
$table->string('ip_address', 45)->nullable()->comment('IP地址');
|
||||
$table->string('mac_address', 17)->nullable()->unique()->comment('MAC地址 (AA:BB:CC:DD:EE:FF)');
|
||||
$table->string('station_id', 50)->nullable()->comment('线站ID');
|
||||
$table->string('diagram_url', 500)->nullable()->comment('组态图URL');
|
||||
$table->json('display_config')->nullable()->comment('显示配置');
|
||||
$table->string('diagram_url', 500)->nullable()->comment('组态界面地址');
|
||||
$table->string('scada_data_url', 500)->nullable()->comment('网关数据查询地址');
|
||||
$table->string('scada_tags_url', 500)->nullable()->comment('网关点位定义查询地址');
|
||||
$table->boolean('is_online')->default(false)->comment('在线状态');
|
||||
$table->timestamp('last_online_at')->nullable()->comment('最后在线时间');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -1,44 +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.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('terminal_sync_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('terminal_id')->comment('终端ID');
|
||||
$table->enum('status', ['pending', 'syncing', 'synced', 'failed'])
|
||||
->default('pending')
|
||||
->comment('同步状态');
|
||||
$table->json('config_snapshot')->nullable()->comment('配置快照');
|
||||
$table->timestamp('synced_at')->nullable()->comment('同步时间');
|
||||
$table->text('error_message')->nullable()->comment('错误信息');
|
||||
$table->timestamps();
|
||||
|
||||
// 添加外键约束
|
||||
$table->foreign('terminal_id')
|
||||
->references('id')
|
||||
->on('terminals')
|
||||
->onDelete('cascade');
|
||||
|
||||
// 添加索引
|
||||
$table->index('status', 'idx_terminal_sync_logs_status');
|
||||
$table->index('synced_at', 'idx_terminal_sync_logs_synced_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('terminal_sync_logs');
|
||||
}
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('terminals', function (Blueprint $table) {
|
||||
$table->string('mac_address', 17)->nullable()->unique()->after('ip_address')
|
||||
->comment('MAC地址 (AA:BB:CC:DD:EE:FF)');
|
||||
$table->string('scada_data_url', 500)->nullable()->after('diagram_url')
|
||||
->comment('OPC UA网关数据查询地址');
|
||||
$table->string('scada_tags_url', 500)->nullable()->after('scada_data_url')
|
||||
->comment('OPC UA网关点位定义查询地址');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('terminals', function (Blueprint $table) {
|
||||
$table->dropColumn(['mac_address', 'scada_data_url', 'scada_tags_url']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -38,8 +38,6 @@ class PermissionSeeder extends Seeder
|
||||
'terminal.create' => '创建终端',
|
||||
'terminal.update' => '编辑终端',
|
||||
'terminal.delete' => '删除终端',
|
||||
'terminal.sync' => '同步终端配置',
|
||||
|
||||
// 操作指引权限
|
||||
'guide.view' => '查看指引',
|
||||
'guide.create' => '创建指引',
|
||||
@@ -127,7 +125,6 @@ class PermissionSeeder extends Seeder
|
||||
'terminal.create',
|
||||
'terminal.update',
|
||||
'terminal.delete',
|
||||
'terminal.sync',
|
||||
|
||||
// 操作指引
|
||||
'guide.view',
|
||||
|
||||
@@ -38,13 +38,6 @@ class TerminalSeeder extends Seeder
|
||||
'ip_address' => $ipAddress,
|
||||
'station_id' => $beamline,
|
||||
'diagram_url' => 'https://ssrf.9z.work/scada/demo.html',
|
||||
'display_config' => [
|
||||
'resolution' => '3840x2160',
|
||||
'refresh_rate' => 60,
|
||||
'orientation' => 'landscape',
|
||||
'brightness' => 80,
|
||||
'touch_enabled' => true,
|
||||
],
|
||||
'is_online' => in_array($beamline, ['BL02U1', 'BL07U', 'BL08U', 'BL13U', 'BL15U']),
|
||||
'last_online_at' => in_array($beamline, ['BL02U1', 'BL07U', 'BL08U', 'BL13U', 'BL15U'])
|
||||
? now()
|
||||
|
||||
Reference in New Issue
Block a user