Files
2026-04-21 23:02:15 +08:00

2.7 KiB

phase, plan, subsystem, tags, dependency_graph, tech-stack, key-files, decisions, metrics
phase plan subsystem tags dependency_graph tech-stack key-files decisions metrics
01 01 admin
lottery
missing-number
backend
requires provides affects
missingNum endpoint
getMissingNumbers model method
i18n keys
application/admin/model/History.php
application/admin/controller/History.php
application/admin/lang/zh-cn/history.php
added patterns
FastAdmin Backend controller
ThinkPHP 5.x Model
Db facade
created modified
application/admin/model/History.php
application/admin/controller/History.php
application/admin/lang/zh-cn/history.php
Used $noNeedRight = ['missingNum'] instead of ['*'] for minimal permission bypass
Model queries up to 500 historical records for true omission count calculation
Color fallback uses '—' string when fa_num table has no mapping for a number
duration completed
~5min 2026-04-21

Phase 01 Plan 01: Backend Missing Number Logic Summary

Backend missing number calculation logic and AJAX endpoint — History model with getMissingNumbers() + calcOmitCount() methods, History controller with missingNum() endpoint, and i18n language keys for the missing number feature.

Tasks Completed

# Task Commit Files
1 Add getMissingNumbers() and calcOmitCount() to History model 6386a40 application/admin/model/History.php
2 Add missingNum() AJAX endpoint to History controller 15bb870 application/admin/controller/History.php
3 Add i18n text keys to language file 96d5e78 application/admin/lang/zh-cn/history.php

One-liner

History model getMissingNumbers() computes missing lottery numbers (1-49) with true omission counts from up to 500 historical records, controller missingNum() validates periods (1-100) and returns JSON, i18n file provides Chinese translations.

Key Decisions

  • $noNeedRight minimal scope: Only missingNum method is exempted from permission checks (not ['*']), following least-privilege principle.
  • 500-record limit for omission calculation: Queries up to 500 historical records to calculate true omission counts (last appearance distance), not just "appeared/not appeared" in the query window.
  • Color fallback: Returns '—' when fa_num table lacks a wave color mapping for a given number.

Deviations from Plan

None - plan executed exactly as written.

Known Stubs

None.

Threat Flags

None beyond what was identified in the plan's threat model (T-01-01 through T-01-04).

Self-Check

  • Model file exists with both methods: PASS
  • Controller file exists with missingNum endpoint: PASS
  • Lang file exists with all i18n keys: PASS
  • All 3 commits present in git log: PASS

Self-Check: PASSED