You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wang 9a9352b340
究极无敌稳定版
9 months ago
..
backend 究极无敌稳定版 9 months ago
frontend 究极无敌稳定版 9 months ago
images 优化游戏界面 10 months ago
.dockerignore Merge branch 'main' of https://bdgit.educoder.net/pfu6rofc7/Goldminer_new into lgw 10 months ago
.env.example Merge branch 'main' of https://bdgit.educoder.net/pfu6rofc7/Goldminer_new into lgw 10 months ago
.gitignore Merge branch 'main' of https://bdgit.educoder.net/pfu6rofc7/Goldminer_new 10 months ago
README.md 优化游戏界面 10 months ago
docker-compose.yml 修改容器 10 months ago
restart_backend.bat 发送语音 10 months ago
start.bat 优化游戏界面 10 months ago

README.md

黄金矿工游戏系统

黄金矿工是一个基于Web的多人在线游戏系统使用Vue.js和Flask开发支持Docker一键部署。

项目特点

  • 经典黄金矿工游戏玩法
  • 实时排行榜和聊天系统
  • 用户账户系统
  • 完整的管理员后台
  • Docker化部署便于安装和维护

系统架构

  • 前端Vue.js、Socket.IO-client
  • 后端Flask、Flask-SocketIO、SQLAlchemy
  • 数据库MySQL
  • 部署Docker、Nginx

Docker部署说明

本项目已完全支持Docker部署只需几个简单的步骤即可运行

环境要求

  • Docker 20.10+
  • Docker Compose 2.0+

部署步骤

  1. 克隆项目代码:
git clone <仓库地址>
cd goldminer
  1. 创建环境配置文件(可选):
# 复制示例配置
cp .env.example .env

# 根据需要编辑配置
nano .env  # 或使用其他编辑器
  1. 启动服务:
# Windows用户
start.bat

# Linux/Mac用户
bash start.sh

或者手动启动:

# 构建并启动容器
docker-compose up -d --build
  1. 访问服务:

环境变量说明

可以通过创建.env文件或设置环境变量来自定义配置:

变量名 说明 默认值
PORT 网站访问端口 8080
FLASK_ENV Flask环境 production
DB_HOST 数据库主机 mysql2.sqlpub.com
DB_PORT 数据库端口 3307
DB_USER 数据库用户名 goldminer
DB_PASSWORD 数据库密码 nBAWq9DDwJ14Fugq
DB_NAME 数据库名称 goldminer
SECRET_KEY 应用密钥 dev_key_for_goldminer
ADMIN_SETUP_KEY 管理员设置密钥 goldminer_admin_setup_key

常见问题排查

  1. 如果无法访问前端页面,请检查:

    • 确认容器是否正常运行:docker-compose ps
    • 查看前端日志:docker-compose logs frontend
    • 检查端口是否被占用:netstat -ano | findstr 8080
  2. 如果图片资源无法显示:

    • 确认项目根目录下是否存在images文件夹
    • 确保images文件夹中包含必要的图片资源
    • 查看nginx日志docker-compose logs frontend
  3. 如果后端API无法连接

    • 检查后端服务是否正常:docker-compose logs backend
    • 确认数据库连接信息是否正确

手动开发环境搭建

后端开发

  1. 安装Python依赖
cd backend
pip install -r requirements.txt
python run_server.py
  1. 后端服务将在 http://localhost:5000 运行

前端开发

  1. 安装依赖
cd frontend
npm install
  1. 启动开发服务器
npm run serve
  1. 前端开发服务器将在 http://localhost:8080 运行

游戏功能

  • 用户注册与登录
  • 黄金矿工经典游戏玩法
  • 实时排行榜
  • 游戏历史记录
  • 实时聊天室
  • 管理后台
    • 用户管理
    • 排行榜管理
    • 游戏历史管理

管理员功能

  • 用户管理:查看、编辑、删除用户
  • 排行榜管理:查看、重置排行榜
  • 游戏历史管理:查看、删除游戏记录

生产环境部署

  1. 修改 .env 文件中的生产环境配置
  2. 启动Docker容器
docker compose up -d

开发者

  • [Your Name]

许可证

MIT