Files
worldcup-predictor/README.md

132 lines
4.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 世界杯预测系统
一个展示世界杯比赛预测结果的Web应用支持多算法预测对比和管理后台。
## 功能特点
### 前端展示
- 📊 **统计概览**:总比赛数、即将进行的比赛、算法数量、总体准确率
- 📅 **即将进行的比赛**:展示未来比赛及其多个算法的预测结果
-**已完成的比赛**:展示历史比赛结果和预测准确情况
- 🤖 **算法排行榜**:展示各算法的准确率、预测数、正确数统计
- 🎯 **预测详情**:点击比赛或算法可查看详细预测历史
### 管理后台
- ⚙️ **系统配置**
- 预测周期(小时)
- 最近预测时间
- 世界杯年份
- 🤖 **算法管理**
- 添加/编辑/删除预测算法
- 启用/禁用算法状态
-**比赛管理**
- 添加/编辑/删除比赛
- 设置比赛时间、比分、状态
- 🎯 **预测管理**
- 添加预测结果
- 评估预测准确性
- 按比赛筛选预测
## 技术栈
- **后端**Python Flask
- **数据库**SQLite
- **前端**HTML/CSS/JavaScript原生无框架
- **样式**现代玻璃态设计Glassmorphism
## 访问地址
系统已部署在端口 **16015**
- **主页**http://192.168.0.101:16015/
- **管理后台**http://192.168.0.101:16015/admin
## 快速启动
```bash
# 进入项目目录
cd /home/openclaw/.openclaw/workspace-hz4th_coder/works/worldcup-predictor
# 启动服务
/home/hz1/miniconda3/envs/openclaw/bin/python backend/app.py
```
## API接口
### 比赛
- `GET /api/matches` - 获取所有比赛
- `GET /api/matches?status=upcoming` - 获取即将进行的比赛
- `GET /api/matches?status=finished` - 获取已完成的比赛
- `GET /api/matches/{id}` - 获取单场比赛详情
- `POST /api/matches` - 添加比赛
- `PUT /api/matches/{id}` - 更新比赛
- `DELETE /api/matches/{id}` - 删除比赛
### 算法
- `GET /api/algorithms` - 获取所有算法
- `GET /api/algorithms/{id}` - 获取单个算法详情(含预测历史)
- `POST /api/algorithms` - 添加算法
- `PUT /api/algorithms/{id}` - 更新算法
- `DELETE /api/algorithms/{id}` - 删除算法
### 预测
- `POST /api/predictions` - 添加预测
- `POST /api/predictions/evaluate` - 评估已完成比赛的预测结果
### 配置与统计
- `GET /api/config` - 获取系统配置
- `POST /api/config` - 更新系统配置
- `GET /api/stats/overview` - 获取总体统计
## 数据库结构
### algorithms算法表
- id, name, description, accuracy, total_predictions, correct_predictions, is_active
### matches比赛表
- id, match_code, home_team, away_team, match_time, home_score, away_score, status, round_name
### predictions预测表
- id, match_id, algorithm_id, predicted_home_score, predicted_away_score, predicted_winner, confidence, is_correct
### system_config配置表
- config_key, config_value, updated_at
## 示例数据
系统已预置示例数据:
- 4个预测算法AI预测模型、专家预测系统、情绪分析模型、历史数据模型
- 5场比赛决赛、半决赛、8强、小组赛
- 10条预测记录
## 文件结构
```
worldcup-predictor/
├── backend/
│ ├── app.py # Flask后端应用
│ ├── requirements.txt # Python依赖
│ └── worldcup.db # SQLite数据库
├── frontend/
│ ├── index.html # 主页
│ ├── admin.html # 管理后台
│ ├── css/
│ │ └── style.css # 样式文件
│ └── js/
│ ├── app.js # 主页逻辑
│ └── admin.js # 管理后台逻辑
├── start.sh # 启动脚本
└── README.md # 说明文档
```
## 注意事项
- 当前使用Flask开发服务器适合演示和测试
- 生产环境建议使用nginx + gunicorn部署
- 数据库文件位于 `backend/worldcup.db`,可直接备份
- 支持跨域访问CORS已启用
---
开发时间2026-06-28
开发者黄庄4号程序员