实现游戏大厅与房间模块:玩法插件化、匹配与房间生命周期管理

This commit is contained in:
2026-09-28 00:10:11 +08:00
parent 99d1827262
commit fb5a730ef3
19 changed files with 2492 additions and 18 deletions
+13
View File
@@ -3,6 +3,7 @@ package routers
import (
"net/http"
"git.lzcwy.cn/zhengchiliu/zt-online-game-backend/global"
"git.lzcwy.cn/zhengchiliu/zt-online-game-backend/internal/middleware"
v1 "git.lzcwy.cn/zhengchiliu/zt-online-game-backend/internal/routers/api/v1"
"git.lzcwy.cn/zhengchiliu/zt-online-game-backend/internal/wsgateway"
@@ -49,5 +50,17 @@ func NewRouter() *gin.Engine {
auth.POST("/user/avatar/upload", userHandler.AvatarUpload)
}
// ===== 开发调试路由(仅 debug 模式注册)=====
// 1) /api/v1/dev/token:跳过微信登录直接换取令牌,便于联调
// 2) /test:WebSocket 联调页面(单页面双开两个玩家)
if global.ServerSetting != nil && global.ServerSetting.RunMode == gin.DebugMode {
devHandler := v1.NewDevHandler()
apiV1.GET("/dev/token", devHandler.Token)
r.GET("/test", func(c *gin.Context) {
c.File("web/ws-test.html") // 相对工作目录(项目根)读取静态页面
})
}
return r
}