From 132c36e9eff65b419df8b2a705322f1db92de717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Mon, 17 Jul 2023 13:50:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E9=A3=8E=E8=AE=BE=E5=A4=87=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=83=A8=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/DeviceLogSyncCommand.php | 6 ++++++ app/Models/Device.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/app/Console/Commands/DeviceLogSyncCommand.php b/app/Console/Commands/DeviceLogSyncCommand.php index 28020b0..02bc61c 100644 --- a/app/Console/Commands/DeviceLogSyncCommand.php +++ b/app/Console/Commands/DeviceLogSyncCommand.php @@ -63,7 +63,13 @@ class DeviceLogSyncCommand extends Command /** @var \Illuminate\Database\Eloquent\Collection */ $devices = Device::with(['factory'])->poweredBy($factory)->get(); + /** @var \App\Models\Device */ foreach ($devices as $device) { + // 忽略通风设备 + if ($device->isTypeAir()) { + continue; + } + $this->info('=========================================='); $this->info('设备编号: ' . $device->sn); $this->info('设备名称: ' . $device->name); diff --git a/app/Models/Device.php b/app/Models/Device.php index 0afe60b..4ed8252 100644 --- a/app/Models/Device.php +++ b/app/Models/Device.php @@ -87,4 +87,9 @@ class Device extends Model { return $this->type === static::TYPE_METEOROLOGICAL; } + + public function isTypeAir(): bool + { + return $this->type === static::TYPE_AIR; + } }