[RELEASE] demo → main:OTA 更新進度 ACK 處理修復上線

1. [FIX] OTA 更新進度 ACK 不應視為指令終態:update_app 指令收到 result="progress" 時維持 pending,僅將進度訊息寫入 note,避免 APK 下載/安裝過程被誤標為完成、與機台實際版本不符。
This commit is contained in:
sky121113 2026-06-17 20:03:17 +08:00
commit f01bffecd9

View File

@ -79,6 +79,19 @@ class ProcessCommandAck implements ShouldQueue
return;
}
// OTA 更新例外處理APK 下載/安裝為長時程作業機台會持續回報「進度」ACK
// (result="progress"如「Downloading 45%」「Installing...」)。這些屬於過程回報,
// 不可視為終態,否則指令會在「剛開始下載」就被標記完成,與機台實際版本不符。
// 僅將進度文字寫入 note 供後台檢視,並保持 pending等待最終 success/failed。
if ($command->command_type === 'update_app' && $resultCode === 'progress') {
$command->update(['note' => $this->payload['message'] ?? $command->note]);
Log::info('MQTT CommandAck: update_app progress (kept pending)', [
'command_id' => $commandId,
'message' => $this->payload['message'] ?? null,
]);
return;
}
// 判定執行結果 (result: "success" 或 "0" 代表成功)
$status = in_array($resultCode, ['success', '0'], true) ? 'success' : 'failed';