[FEAT] 調整環境溫度上報文檔順序與機台硬體事件日誌歸類
1. 文件調整:將 config/api-docs.php 中的「機台環境溫度上報 (mqtt-ambient-temp-report)」MQTT API 區塊位置向上移至「機台硬體事件上報 (mqtt-event)」上方。 2. 日誌歸類:修改 ProcessMachineEvent.php,將機台硬體事件 (event) 日誌寫入資料庫時的 type 從 'status' (機台狀態) 改為 'ambient_temp' (環境溫度回傳),以直接顯示於「環境溫度回傳」Tab。
This commit is contained in:
parent
cacae84a85
commit
7579a0b5be
@ -45,10 +45,10 @@ class ProcessMachineEvent implements ShouldQueue
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 寫入機台狀態日誌,type 為 'status' 以便正確歸類顯示於「機台狀態」日誌中
|
// 寫入環境溫度日誌,type 為 'ambient_temp' 以便正確歸類顯示於「環境溫度回傳」日誌中
|
||||||
$machine->logs()->create([
|
$machine->logs()->create([
|
||||||
'company_id' => $machine->company_id,
|
'company_id' => $machine->company_id,
|
||||||
'type' => 'status', // 忠實呈現於機台狀態中
|
'type' => 'ambient_temp', // 歸類至環境溫度回傳
|
||||||
'level' => 'info',
|
'level' => 'info',
|
||||||
'message' => $event, // 例如 "fanon" 或 "fanoff"
|
'message' => $event, // 例如 "fanon" 或 "fanoff"
|
||||||
'context' => $this->payload,
|
'context' => $this->payload,
|
||||||
|
|||||||
@ -540,6 +540,22 @@ return [
|
|||||||
'status' => 'online'
|
'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)',
|
'name' => '機台硬體事件上報 (Event)',
|
||||||
'slug' => 'mqtt-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)',
|
'name' => '指令執行回報 (Machine to Cloud)',
|
||||||
'slug' => 'mqtt-command-ack',
|
'slug' => 'mqtt-command-ack',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user