From c1bf9294cdbdeaf244aff40c59a783f4f889c669 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Tue, 21 Apr 2026 16:50:30 +0800 Subject: [PATCH] =?UTF-8?q?[DELETE]=20=E7=A7=BB=E9=99=A4=20B010=20(Heartbe?= =?UTF-8?q?at)=20HTTP=20API=20=E6=AE=98=E7=95=99=E8=88=87=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 從 config/api-docs.php 中完全移除 B010 配置。 2. 清理 routes/api.php 中關於 B010 的註解。 3. 更新 api-technical-specs/SKILL.md,將依賴 B010 的觸發描述改為 MQTT 指令。 4. 補上 B010 在 SKILL.md 中的廢棄區塊並導向 MQTT 規範。 --- .agents/skills/api-technical-specs/SKILL.md | 9 +- config/api-docs.php | 111 -------------------- routes/api.php | 2 +- 3 files changed, 8 insertions(+), 114 deletions(-) diff --git a/.agents/skills/api-technical-specs/SKILL.md b/.agents/skills/api-technical-specs/SKILL.md index 5f68fc0..0eac408 100644 --- a/.agents/skills/api-technical-specs/SKILL.md +++ b/.agents/skills/api-technical-specs/SKILL.md @@ -154,6 +154,11 @@ description: 本技能規範定義了 Star Cloud 系統中所有機台 (IoT) 與 > **此 REST API 已廢棄並移除**。機台異常上報已全面遷移至 **MQTT** 即時通訊架構。 > 請參閱 [MQTT 通訊規範 - B013 異常上報](file:///home/mama/projects/star-cloud/.agents/skills/mqtt-communication-specs/SKILL.md#32-異常與錯誤上報-b013) 進行串接。 +### 3.12 B010: [DEPRECATED / REMOVED] 心跳上報與狀態同步 +> [!WARNING] +> **此 REST API 已廢棄並移除**。機台心跳上報與指令下發已全面遷移至 **MQTT** 架構。 +> 請參閱 [MQTT 通訊規範 - B010 心跳上報](file:///home/mama/projects/star-cloud/.agents/skills/mqtt-communication-specs/SKILL.md#31-心跳上報-b010) 進行串接。 + #### B013 硬體代碼對照表 (由 MachineService 自動翻譯) | 代碼 | 英文 Key (i18n) | 級別 | 範例繁中翻譯 | @@ -200,7 +205,7 @@ description: 本技能規範定義了 Star Cloud 系統中所有機台 (IoT) 與 --- ### 3.8 B017: 貨道庫存同步 (Slot Synchronization) -用於機台端獲取目前所有貨道的最新庫存、效期與狀態。通常由 B010 回應 `status: 49` 觸發。 +用於機台端獲取目前所有貨道的最新庫存、效期與狀態。通常由 **MQTT 指令 (`reload_stock`)** 觸發。 - **URL**: GET /api/v1/app/machine/reload_msg/B017 - **Authentication**: Bearer Token (Header) @@ -282,7 +287,7 @@ description: 本技能規範定義了 Star Cloud 系統中所有機台 (IoT) 與 - **URL**: GET|PUT /api/v1/app/machine/dispense/B055 - **Authentication**: Bearer Token (Header) - **運作模式**: - - **GET (查詢)**:當 B010 收到 `status: 85` 時呼叫。雲端會回傳待執行的貨道編號與指令 ID。 + - **GET (查詢)**:當收到 **MQTT 指令 (`force_dispense` 或 `compensation`)** 時呼叫。雲端會回傳待執行的貨道編號與指令 ID。 - **PUT (回報)**:實體出貨完成後回饋結果,以便雲端將該指令標記為「已執行」。 - **Response Body (GET - 查詢階段):** diff --git a/config/api-docs.php b/config/api-docs.php index 161f242..14ac369 100644 --- a/config/api-docs.php +++ b/config/api-docs.php @@ -228,117 +228,6 @@ return [ 'status' => '49' ], ], - [ - 'name' => 'B010: 心跳上報與狀態同步 (Heartbeat)', - 'slug' => 'b010-heartbeat', - 'method' => 'POST', - 'path' => '/api/v1/app/machine/status/B010', - 'description' => '機台定期向雲端回報當前頁面、版本、溫度及門禁狀態。身份由 Bearer Token 識別。', - 'headers' => [ - 'Authorization' => 'Bearer ', - 'Content-Type' => 'application/json', - ], - 'parameters' => [ - 'current_page' => [ - 'type' => 'integer', - 'required' => true, - 'description' => '當前頁面編號。對照表: -0: 離線, 1: 主頁面, 2: 販賣頁, 3: 管理頁, 4: 補貨頁, 5: 教學頁 -6: 購買中, 7: 鎖定頁, 60: 出貨成功, 61: 貨道測試, 62: 付款選擇 -63: 等待付款, 64: 出貨, 65: 收據簽單, 66: 通行碼, 67: 取貨碼 -68: 訊息顯示, 69: 取消購買, 610: 購買結束, 611: 來店禮, 612: 出貨失敗', - 'example' => 1 - ], - 'firmware_version' => [ - 'type' => 'string', - 'required' => true, - 'description' => '軟體或韌體版本號', - 'example' => '1.0.5' - ], - 'model' => [ - 'type' => 'string', - 'required' => false, - 'description' => '機台型號', - 'example' => 'STAR-V1' - ], - 'temperature' => [ - 'type' => 'float', - 'required' => false, - 'description' => '感測環境溫度', - 'example' => 25.5 - ], - 'door_status' => [ - 'type' => 'integer', - 'required' => false, - 'description' => '門禁狀態 (0: 關閉, 1: 開啟)', - 'example' => 0 - ], - 'log' => [ - 'type' => 'string', - 'required' => false, - 'description' => '事件日誌主訊息', - 'example' => 'Door opened' - ], - 'log_level' => [ - 'type' => 'string', - 'required' => false, - 'description' => '日誌等級 (info, warning, error)', - 'example' => 'info' - ], - 'log_payload' => [ - 'type' => 'object', - 'required' => false, - 'description' => '詳細上下文 (JSON 對象)', - 'example' => ['error_code' => 500, 'component' => 'door_sensor'] - ], - ], - 'response_parameters' => [ - 'success' => [ - 'type' => 'boolean', - 'description' => '請求是否處理成功', - 'example' => true - ], - 'code' => [ - 'type' => 'integer', - 'description' => '內部業務狀態碼', - 'example' => 200 - ], - 'message' => [ - 'type' => 'string', - 'description' => '回應訊息說明', - 'example' => 'OK' - ], - 'status' => [ - 'type' => 'string', - 'description' => '雲端指令代碼。對照表: -49: reload B017 (貨道同步), 51: reboot (重啟系統) -60: reboot card machine (刷卡機重啟), 61: checkout (觸發結帳) -70: unlock (解鎖), 71: lock (鎖定), 85: reload B0552 (遠端出貨) -待定義: change (遠端找零 - 目前 Java App 尚無對接)', - 'example' => '49' - ], - ], - 'request' => [ - 'current_page' => 1, - 'firmware_version' => '1.0.5', - 'model' => 'STAR-V1', - 'temperature' => 25.5, - 'door_status' => 0, - 'log' => 'Door opened', - 'log_level' => 'info', - 'log_payload' => [ - 'error_code' => 500, - 'component' => 'door_sensor' - ], - ], - 'response' => [ - 'success' => true, - 'code' => 200, - 'message' => 'OK', - 'status' => '49' - ], - 'notes' => '機台收到 B010 回應中的特定 `status` 代碼後,應根據對照表執行對應的指令動作或 API 呼叫 (如 B017)。若為空則代表無指令。' - ], [ 'name' => 'B012: 商品配置與商品主檔同步 (Unified Sync)', 'slug' => 'b012-unified-sync', diff --git a/routes/api.php b/routes/api.php index 936abba..40f7d96 100644 --- a/routes/api.php +++ b/routes/api.php @@ -57,7 +57,7 @@ Route::prefix('v1')->middleware(['throttle:api'])->group(function () { }); Route::prefix('app')->middleware(['iot.auth', 'throttle:100,1'])->group(function () { - // 心跳與狀態 (B010, B017, B710, B220) + // 機台狀態與相關同步 (B017, B710, B220) Route::get('machine/reload_msg/B017', [App\Http\Controllers\Api\V1\App\MachineController::class, 'getSlots']); Route::post('machine/timer/B710', [App\Http\Controllers\Api\V1\App\MachineController::class, 'syncTimer']);