From 7579a0b5be24a537c0b497c9ff325186584ea7ff Mon Sep 17 00:00:00 2001 From: sky121113 Date: Thu, 4 Jun 2026 12:00:54 +0800 Subject: [PATCH] =?UTF-8?q?[FEAT]=20=E8=AA=BF=E6=95=B4=E7=92=B0=E5=A2=83?= =?UTF-8?q?=E6=BA=AB=E5=BA=A6=E4=B8=8A=E5=A0=B1=E6=96=87=E6=AA=94=E9=A0=86?= =?UTF-8?q?=E5=BA=8F=E8=88=87=E6=A9=9F=E5=8F=B0=E7=A1=AC=E9=AB=94=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=97=A5=E8=AA=8C=E6=AD=B8=E9=A1=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 文件調整:將 config/api-docs.php 中的「機台環境溫度上報 (mqtt-ambient-temp-report)」MQTT API 區塊位置向上移至「機台硬體事件上報 (mqtt-event)」上方。 2. 日誌歸類:修改 ProcessMachineEvent.php,將機台硬體事件 (event) 日誌寫入資料庫時的 type 從 'status' (機台狀態) 改為 'ambient_temp' (環境溫度回傳),以直接顯示於「環境溫度回傳」Tab。 --- app/Jobs/Machine/ProcessMachineEvent.php | 4 +-- config/api-docs.php | 32 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/Jobs/Machine/ProcessMachineEvent.php b/app/Jobs/Machine/ProcessMachineEvent.php index b6f0535..0a282ea 100644 --- a/app/Jobs/Machine/ProcessMachineEvent.php +++ b/app/Jobs/Machine/ProcessMachineEvent.php @@ -45,10 +45,10 @@ class ProcessMachineEvent implements ShouldQueue return; } - // 寫入機台狀態日誌,type 為 'status' 以便正確歸類顯示於「機台狀態」日誌中 + // 寫入環境溫度日誌,type 為 'ambient_temp' 以便正確歸類顯示於「環境溫度回傳」日誌中 $machine->logs()->create([ 'company_id' => $machine->company_id, - 'type' => 'status', // 忠實呈現於機台狀態中 + 'type' => 'ambient_temp', // 歸類至環境溫度回傳 'level' => 'info', 'message' => $event, // 例如 "fanon" 或 "fanoff" 'context' => $this->payload, diff --git a/config/api-docs.php b/config/api-docs.php index 6002308..94009ef 100644 --- a/config/api-docs.php +++ b/config/api-docs.php @@ -540,6 +540,22 @@ return [ 'status' => 'online' ], ], + [ + 'name' => '機台環境溫度上報 (Ambient Temperature Report)', + 'slug' => 'mqtt-ambient-temp-report', + 'action' => 'PUB', + 'topic' => 'machine/{serial_no}/ambient_temp', + 'qos' => 1, + 'description' => '機台主動上報當前環境溫度。支援 temperature 或 ambient_temp 欄位上報。', + 'payload_parameters' => [ + 'temperature' => ['type' => 'integer', 'description' => '當前環境溫度值 (例如 28)'], + 'ambient_temp' => ['type' => 'integer', 'description' => '當前環境溫度值 (相容相應硬體參數)'], + ], + 'payload_example' => [ + 'temperature' => 28 + ], + ], + [ 'name' => '機台硬體事件上報 (Event)', 'slug' => 'mqtt-event', @@ -806,22 +822,6 @@ return [ ], ], - [ - 'name' => '機台環境溫度上報 (Ambient Temperature Report)', - 'slug' => 'mqtt-ambient-temp-report', - 'action' => 'PUB', - 'topic' => 'machine/{serial_no}/ambient_temp', - 'qos' => 1, - 'description' => '機台主動上報當前環境溫度。支援 temperature 或 ambient_temp 欄位上報。', - 'payload_parameters' => [ - 'temperature' => ['type' => 'integer', 'description' => '當前環境溫度值 (例如 28)'], - 'ambient_temp' => ['type' => 'integer', 'description' => '當前環境溫度值 (相容相應硬體參數)'], - ], - 'payload_example' => [ - 'temperature' => 28 - ], - ], - [ 'name' => '指令執行回報 (Machine to Cloud)', 'slug' => 'mqtt-command-ack',