feat(invoice): 統一發票對獎 (stage C item 1)#74
Merged
Conversation
新工具「發票對獎」+全站第二支 serverless function。 - src/lib/invoice.ts:財政部 invoice.xml 解析與對獎規則(TDD,17 tests)。 漸進式對獎:末 3 碼即可確判「沒中」或六獎/增開六獎, 頭獎末碼系列逐碼升級,特別獎/特獎需 8 碼全中才確認。 號碼全程字串處理,前導零不掉。 - api/invoice-numbers.ts:代抓財政部公開 RSS(固定網址、免金鑰、 無使用者輸入故無 SSRF 面),CDN 快取 s-maxage=3600 + SWR 一天。 - src/tools/InvoiceLottery.tsx:期別切換、開獎號碼卡、即時對獎、 錯誤重試;中英雙語頁面,tools.ts 註冊(實用工具 🧧)。 - OG 卡:npm run og 產出 zh/en 兩張(68 張,og.test 守門),已目測。 - e2e:stub /api/invoice-numbers,涵蓋載入、快篩沒中、增開六獎、 8 碼頭獎、期別切換、API 掛掉重試(+3)。 測試:typecheck:api ✓ / 530 unit ✓(+17)/ 57 e2e ✓(+3) 合併後需立即驗 production /api/invoice-numbers(preview 在 SSO 後面)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
階段 C 第 1 項(HANDOFF 待辦,回訪黏性最高):發票對獎 —— 自動抓財政部最新
開獎號碼,輸入末 3 碼立刻知道有沒有中,補到 8 碼確認獎級。全站第二支 serverless function。
資料源
財政部公開 RSS
https://invoice.etax.nat.gov.tw/invoice.xml(免金鑰、含近六期號碼)。固定網址、無使用者輸入 → 無 SSRF 面,不需要走 ssrfGuard。
開獎兩個月一次,CDN 快取
s-maxage=3600, stale-while-revalidate=86400。對獎規則(
src/lib/invoice.ts,TDD 17 tests)對中頭獎末碼 → 當下獎級已確定、提示續輸可能升級;只對中特別獎/特獎末碼 → 提示補完 8 碼確認
00507588)驗證
typecheck:api✓ / 530 unit ✓(+17)/ 57 e2e ✓(+3,stub API:載入、快篩沒中、增開六獎、8 碼頭獎、期別切換、API 掛掉重試)
og.test.ts守門)並依教訓 feat(bingo): bring bingo game into master #3 目測過兩張新卡api/,preview 部署在 Vercel SSO 後面,合併後須立即實打 production
/api/invoice-numbers驗證(回傳期別數、號碼格式、快取標頭)🤖 Generated with Claude Code