zyh c6e8953960 feat: 更新数据库结构和链接任务逻辑
主要修改:
1. 更新`game.sql`文件,添加`system_config`表并调整多个表的`ENGINE`和`AUTO_INCREMENT`设置。
2. 在`LinkTask`实体中新增`completedPoints`字段,更新状态字段以包含`COMPLETED`状态。
3. 在`LinkTaskMapper`中新增根据设备ID和状态查询链接任务的方法。
4. 在`LinkStatusService`中更新状态描述映射,增加对`COMPLETED`状态的处理。
5. 在`DeviceStatusService`和`ScriptClient`中新增解析设备状态的方法,支持检查设备是否完成游戏。

技术细节:
- 通过数据库结构的更新,增强了系统的配置管理和链接任务的状态处理能力。
- 新增的功能支持更灵活的设备状态监控和任务管理。
2025-08-27 16:00:43 +08:00
1
2025-08-26 15:18:14 +08:00
2025-08-24 15:33:03 +08:00

Game Platform Server (Spring Boot WebFlux + MyBatis + MySQL)

A minimal backend scaffold using Spring Boot 3, WebFlux, MyBatis, and MySQL. Includes a sample User CRUD implemented via MyBatis (blocking JDBC) safely wrapped in reactive APIs.

Tech Stack

  • Spring Boot 3 (WebFlux, Actuator)
  • MyBatis Spring Boot Starter (JDBC)
  • MySQL Connector/J
  • Java 17

Blocking JDBC with WebFlux

MyBatis uses JDBC which is blocking. To keep WebFlux event loop non-blocking, all data access is offloaded to Schedulers.boundedElastic() (see UserService). This is a common and safe pattern when you need WebFlux endpoints but must use JDBC/MyBatis.

Project Layout

  • pom.xml Maven build, dependencies
  • src/main/resources/application.yml datasource + mybatis config
  • src/main/resources/mapper/*.xml MyBatis mappers (XML)
  • src/main/resources/schema.sql initial table
  • src/main/java/com/gameplatform/server application code

Configure Database

  1. Create database:
    CREATE DATABASE game_platform CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
    
  2. Update spring.datasource.* in application.yml with your MySQL credentials.
  3. Run the SQL init:
    USE game_platform;
    -- then execute contents of src/main/resources/schema.sql
    

Build & Run

Requires JDK 17+ and Maven 3.9+.

mvn spring-boot:run

The app starts on http://localhost:8080.

Endpoints

  • GET /actuator/health health check
  • GET /api/users list users
  • GET /api/users/{id} get user by id
  • POST /api/users create user
    • body:
      {"username": "alice", "email": "alice@example.com"}
      
  • DELETE /api/users/{id} delete user

Notes

  • If you need true end-to-end reactive IO, consider R2DBC instead of JDBC/MyBatis. Here we keep MyBatis for mapping convenience and use bounded elastic threads to avoid blocking the event loop.
Description
No description provided
Readme 4 MiB
Languages
Java 98%
Python 2%