feat: BIZ-75 双色球系统改进

1. P1: 合并双 Flask 服务 — web_executor.py 功能整合到 app.py
   - /fetch → 抓取控制台页面
   - /api/fetch/status → 抓取状态查询
   - /api/fetch/execute → 触发抓取(后台线程异步)
   - web_console.html API 路径已更新

2. P1: fetch_data.py 增加重试机制 + 请求间隔
   - REQUEST_DELAY=2s, MAX_RETRIES=3, RETRY_DELAY=5s
   - 修复缩进 bug(try/except 块缩进错误)

3. P0: 修复 Excel 数据格式兼容性
   - fetch_data.py: 跳过网页 header 行,使用标准列名保存
   - app.py: 新增 load_history_dataframe() 智能加载函数
   - 兼容新旧两种 Excel 格式(一行/两行 header)
   - 统一列名: 开奖时间|期数|号码|开机号|和值特征|奇偶比|大小比|奇偶形态|跨度|其他

4. 运维: 创建 lotto-app.service systemd 单元
5. 修复 .gitignore(排除运行时数据文件和备份)
6. 创建 requirements.txt
This commit is contained in:
2026-07-03 17:41:15 +08:00
parent ae5d7a08ff
commit cf4b5764b5
6 changed files with 338 additions and 73 deletions
+5 -5
View File
@@ -192,7 +192,7 @@
<h3>📋 使用说明</h3>
<ul>
<li>✅ 点击「立即执行」按钮抓取最新双色球历史数据</li>
<li>✅ 数据将保存到:<code>/Users/vincent/Studio/lottoData/双色球历史数据.xlsx</code></li>
<li>✅ 数据将保存到:<code>/home/vincent/Studio/lottoData/双色球历史数据.xlsx</code></li>
<li>✅ 定时任务:每天自动执行一次(通过系统 cron)</li>
<li>✅ 实时监控:执行日志在此页面实时显示</li>
</ul>
@@ -211,7 +211,7 @@
</div>
<div class="last-update">
脚本路径:<code>/Users/vincent/Studio/lottoData/fetch_data.py</code> |
脚本路径:<code>/home/vincent/Studio/lottoData/fetch_data.py</code> |
输出文件:<span id="outputFile">双色球历史数据.xlsx</span>
</div>
</div>
@@ -246,7 +246,7 @@
updateStatus('running', '执行中');
try {
const response = await fetch('/api/execute', {
const response = await fetch('/api/fetch/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
});
@@ -263,7 +263,7 @@
// 轮询状态直到完成
const pollInterval = setInterval(async () => {
try {
const statusResp = await fetch('/api/status');
const statusResp = await fetch('/api/fetch/status');
const status = await statusResp.json();
if (!status.isRunning) {
@@ -303,7 +303,7 @@
async function loadStatus() {
try {
const response = await fetch('/api/status');
const response = await fetch('/api/fetch/status');
if (response.ok) {
const data = await response.json();
if (data.lastUpdate) {