[PROMOTE] dev → demo:補齊 B690 來店禮錯誤回應文件
1. [DOCS] B690 來店禮驗證新增 400 / 404 / 429 錯誤回應 (SKILL.md、api-docs.php、api-docs.blade.php)。
This commit is contained in:
commit
e0c4da0933
@ -336,6 +336,24 @@ description: 本技能規範定義了 Star Cloud 系統中所有機台 (IoT) 與
|
||||
| code | Integer | 業務狀態碼 | 404 |
|
||||
| remaining_attempts | Integer | 剩餘嘗試次數 | 3 |
|
||||
|
||||
**Response (Failed 400 — 格式錯誤):**
|
||||
|
||||
| 參數 | 類型 | 說明 | 範例 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| success | Boolean | 請求是否成功 | false |
|
||||
| message | String | 失敗原因 (code 非 8 位數) | Invalid format |
|
||||
| code | Integer | 業務狀態碼 | 400 |
|
||||
|
||||
**Response (Failed 429 — 已鎖定):**
|
||||
|
||||
連續錯誤達 5 次後,該機台於鎖定期間 (60 秒) 內的所有驗證請求皆回傳此回應。
|
||||
|
||||
| 參數 | 類型 | 說明 | 範例 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| success | Boolean | 請求是否成功 | false |
|
||||
| message | String | 失敗原因 | Too many attempts. Locked. |
|
||||
| code | Integer | 業務狀態碼 | 429 |
|
||||
|
||||
- **消耗機制**: 出貨完成後,由機台發送 MQTT `finalize` 訊息,並在 `payment_type` 帶入 `7` (來店禮) 完成扣減。
|
||||
|
||||
---
|
||||
|
||||
@ -695,6 +695,23 @@ return [
|
||||
'status' => 'active'
|
||||
]
|
||||
],
|
||||
'error_responses' => [
|
||||
[
|
||||
'code' => 400,
|
||||
'message' => 'Invalid format',
|
||||
'description' => 'code 非 8 位數或缺少必填欄位。'
|
||||
],
|
||||
[
|
||||
'code' => 404,
|
||||
'message' => 'Invalid or expired code',
|
||||
'description' => '代碼不存在、已失效或已過期。回應另含 remaining_attempts (剩餘嘗試次數)。'
|
||||
],
|
||||
[
|
||||
'code' => 429,
|
||||
'message' => 'Too many attempts. Locked.',
|
||||
'description' => '連續錯誤達 5 次,該機台驗證功能於鎖定期間 (60 秒) 內皆回傳此回應。'
|
||||
],
|
||||
],
|
||||
'notes' => '安全性:連續錯誤 5 次將鎖定該機台驗證功能 1 分鐘。消耗流程已遷移至 MQTT (payment_type=7)。'
|
||||
],
|
||||
],
|
||||
|
||||
@ -328,6 +328,32 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(isset($api['error_responses']) && count($api['error_responses']) > 0)
|
||||
<div>
|
||||
<h4 class="text-xs font-black text-slate-400 uppercase tracking-widest mb-4">錯誤回應 (Error Responses)</h4>
|
||||
<div class="overflow-hidden rounded-2xl border border-slate-200 shadow-sm bg-white mb-6">
|
||||
<table class="w-full param-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-[15%]">HTTP / code</th>
|
||||
<th class="w-[30%]">message</th>
|
||||
<th>說明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($api['error_responses'] as $err)
|
||||
<tr class="hover:bg-slate-50/50 transition-colors">
|
||||
<td><span class="px-2 py-1 rounded bg-rose-100 text-[10px] font-black text-rose-600 uppercase tracking-wider">{{ $err['code'] }}</span></td>
|
||||
<td class="font-black text-slate-900 text-sm">{{ $err['message'] }}</td>
|
||||
<td class="text-slate-600 font-semibold text-sm whitespace-pre-line">{{ $err['description'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(isset($api['notes']))
|
||||
<div class="p-6 bg-cyan-50/50 border border-cyan-100 rounded-3xl mt-6">
|
||||
<h5 class="text-cyan-700 font-black mb-2 flex items-center gap-2 text-lg">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user