Files
CC-Framework.BriskGameServer/服务参考_临时/README.md

117 lines
3.8 KiB
Markdown
Raw 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.
# Brisk Game Service
Brisk 游戏服务端工程。
当前已实现模块:
- 平台授时 `time`
- 客户端初始化 `bootstrap`
- 登录换票 `auth`
- 玩家信息 `player`
- 动态配置 `config`
- 公告 `announcements`
- 排行榜 `ranks`
- 云存档 `archives`
- 玩家空间 `spaces`
- 管理后台认证、项目、配置、公告、排行榜、存档、玩家、空间、审计
- Worker 清理任务与基础限流
## 当前核心模型
- 项目唯一标识只有 `game_key`
- 项目级 `channel / platform` 已移除
- 初始化和动态配置只依赖 `game_key`,配置筛选只看 `client_version`
- 平台授时接口不依赖 `game_key`,可直接匿名获取 UTC 服务器时间
- 登录模块单独处理第三方身份:
- `login_provider`:如 `tap`
- `login_user_id`:该登录平台返回的稳定唯一用户 ID
- 服务端登录成功后返回内部:
- `player_id`
- `project_account_id`
- `access_token`
- 空间、排行榜后台筛选等模块支持直接使用 `login_provider + login_user_id`
- 内部仍优先解析到 `player_id` 再执行业务查询,便于性能和统一索引
## 本地运行
推荐使用 Docker Compose
```bash
copy .env.example .env
docker compose up --build
```
默认接口:
- `GET /health`
- `GET /api/ping`
- `GET /api/client/time`
- `GET /openapi.yaml`
开发环境默认账号:
- 后台用户名:`admin`
- 后台密码:`admin123456`
- 后台操作员:`operator`
- 操作员密码:`operator123456`
## 接入说明
- 平台授时:
- 匿名接口 `GET /api/client/time`
- 无需传 `game_key`
- 返回 `server_time``server_unix``server_unix_ms`
- 客户端初始化:
- 必填 `game_key`
- 可选 `client_version`
- `device_id` 仅作透传与诊断辅助
- 客户端登录:
- 必填 `game_key`
- 必填 `login_provider`
- `login_user_id``code` 二选一
- 可选透传 `nickname``avatar_url``profile_json`
- 云存档:
- 支持二进制文件上传/下载,适合直接存游戏存档 bytes
- 玩家空间:
- 主信息接口返回空间元数据
- 自定义空间内容通过独立二进制接口上传/下载
- 支持任意 bytes兼容二进制、文本、JSON、protobuf、msgpack 等格式
- 空间点赞按 `Asia/Shanghai` 自然日计周期,同一玩家对同一空间每天最多记一次点赞
- 空间点赞相关接口返回累计点赞数 `like_count`、当日点赞数 `today_like_count`、当日是否已点赞 `liked_by_me`
- 最近访问列表支持可选 `limit` 参数,默认 `50` 条,最大 `100`
## 测试脚本
Windows PowerShell
```powershell
.\scripts\smoke-test.ps1
.\scripts\acceptance.ps1 -Tasks all -ManageStack
.\\scripts\\acceptance.ps1 -Tasks space -ManageStack
```
## 迁移
数据库迁移目录:
- [0001_init.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0001_init.sql)
- [0008_identity_and_config_simplification.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0008_identity_and_config_simplification.sql)
- [0009_space_binary_content.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0009_space_binary_content.sql)
- [0010_space_like_daily_cycle.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0010_space_like_daily_cycle.sql)
服务启动时会自动执行未应用迁移。
## 根目录文档
- [Brisk API接口与示例文档.md](/F:/OtherWork/BriskGameSerivce/Brisk%20API%E6%8E%A5%E5%8F%A3%E4%B8%8E%E7%A4%BA%E4%BE%8B%E6%96%87%E6%A1%A3.md)
- [Brisk Unity SDK接入文档.md](/F:/OtherWork/BriskGameSerivce/Brisk%20Unity%20SDK%E6%8E%A5%E5%85%A5%E6%96%87%E6%A1%A3.md)
- [openapi.yaml](/F:/OtherWork/BriskGameSerivce/openapi.yaml)
## 目录说明
- `cmd/`:启动入口
- `internal/`:内部实现
- `deployments/`:部署配置
- `docs/`:历史设计文档与补充资料
- `scripts/`:脚本