Liveness Check
/health
用途
进程级健康检查。适合平台、负载均衡或 uptime monitor 判断服务是否存活。
{
"status": "ok",
"service": "logforge-backend",
"checks": {
"process": "ok"
}
}面向前端和移动端集成的可视化接口说明。公开 WCL 查询接口负责缓存和代理, 收藏接口依赖 Better Auth session cookie。
所有接口默认返回 JSON,错误响应使用统一的 error 字段。
official, titan, anniversary
US, CN, EU, KR, TW
/api/wcl/favorites* 需要 Better Auth 登录态
使用顶部搜索或分组筛选快速定位接口。
/health
进程级健康检查。适合平台、负载均衡或 uptime monitor 判断服务是否存活。
{
"status": "ok",
"service": "logforge-backend",
"checks": {
"process": "ok"
}
}/ready
依赖级 readiness 检查。数据库和关键认证配置可用时返回 ready,否则返回 503。
{
"status": "ready",
"service": "logforge-backend",
"checks": {
"database": "ok",
"config": {
"databaseUrl": true,
"authUrl": true,
"betterAuthSecret": true,
"googleOAuth": true
}
}
}/api/auth/*
Better Auth 接管的认证路由,支持 Google OAuth、Expo 和 Next cookies。
| 参数 | 必填 | 说明 |
|---|---|---|
| App name | - | LogForge |
| Base URL | - | BETTER_AUTH_URL,默认 http://localhost:3000 |
| Database | - | PostgreSQL via Drizzle adapter |
import { authClient } from "@/lib/auth-client";
await authClient.signIn.social({
provider: "google",
});/api/wcl/regions
获取指定 WCL flavor 可用地区。上游失败时返回配置中的 fallback 地区。
| 参数 | 必填 | 说明 |
|---|---|---|
| flavor | 是 | official, titan, anniversary |
curl "http://localhost:3000/api/wcl/regions?flavor=titan"/api/wcl/servers
获取指定 flavor 和 region 下的服务器列表,结果会写入 region servers cache。
| 参数 | 必填 | 说明 |
|---|---|---|
| flavor | 是 | WCL flavor |
| regionSlug | 是 | WCL region slug |
| regionId | 否 | 不传时按 fallback 顺序推导 |
{
"servers": [
{ "id": 1, "name": "时光", "slug": "时光" }
],
"lastRefreshedAt": "2026-04-29T08:00:00.000Z"
}/api/wcl/characters/search
按角色名搜索指定地区服务器中的角色。空搜索词会直接返回空结果。
| 参数 | 必填 | 说明 |
|---|---|---|
| flavor | 是 | WCL flavor |
| regionSlug | 是 | WCL region slug |
| searchTerm | 否 | 角色名;空值返回空数组 |
{
"results": [
{
"id": "123456",
"name": "Player",
"classID": 1,
"className": "Warrior",
"classSlug": "warrior",
"serverName": "时光",
"serverSlug": "时光"
}
],
"lastRefreshedAt": "2026-04-29T08:00:00.000Z"
}/api/wcl/characters/{id}
获取 WCL 角色详情和可用分区/副本信息。未找到角色时 character 为 null。
| 参数 | 必填 | 说明 |
|---|---|---|
| Path id | 是 | WCL 角色 ID |
| flavor | 是 | WCL flavor |
{
"character": {
"id": 123456,
"name": "Player",
"classID": 1,
"className": "Warrior",
"classSlug": "warrior",
"level": 60,
"server": { "id": 1, "name": "时光", "slug": "时光" },
"specs": [],
"zones": []
},
"lastRefreshedAt": "2026-04-29T08:00:00.000Z"
}/api/wcl/characters/{id}/rankings
获取角色在指定副本、指标、专精和分区下的排名数据;每秒指标会还原 WCL zoneRankings 的内部偏移值。
| 参数 | 必填 | 说明 |
|---|---|---|
| Path id | 是 | 数字字符串 WCL 角色 ID |
| flavor | 是 | WCL flavor |
| metric | 是 | dps, hps, bossdps |
| zoneId | 是 | WCL zone ID |
| specSlug | 否 | 空值代表全部专精 |
| partitionId | 否 | 空值代表默认分区 |
curl "http://localhost:3000/api/wcl/characters/123456/rankings?flavor=titan&metric=dps&zoneId=1049"/api/wcl/favorites
返回当前登录用户的收藏角色列表,按 lastUpdatedAt 倒序排列。
curl "http://localhost:3000/api/wcl/favorites" \
-H "Cookie: better-auth.session_token=..."/api/wcl/favorites
新增或更新一个收藏角色。相同用户、flavor 和角色 id 会执行 upsert。
| 参数 | 必填 | 说明 |
|---|---|---|
| id | 是 | WCL 角色 ID |
| flavor | 是 | WCL flavor |
| regionSlug | 是 | WCL region slug |
| serverSlug | 是 | 服务器 slug |
| serverName | 是 | 服务器名称 |
| characterName | 是 | 角色名 |
| classSlug | 否 | 职业 slug |
| preferredZoneId | 否 | 偏好 zone ID |
| lastUpdatedAt | 否 | 毫秒时间戳 |
{
"id": "123456",
"flavor": "titan",
"regionSlug": "CN",
"serverSlug": "时光",
"serverName": "时光",
"characterName": "Player",
"classSlug": "warrior",
"preferredZoneId": 1049,
"lastUpdatedAt": 1777449600000
}/api/wcl/favorites/{id}
删除当前登录用户指定 flavor 下的收藏角色。
| 参数 | 必填 | 说明 |
|---|---|---|
| Path id | 是 | WCL 角色 ID |
| flavor | 是 | WCL flavor |
curl -X DELETE "http://localhost:3000/api/wcl/favorites/123456?flavor=titan" \
-H "Cookie: better-auth.session_token=..."/api/wcl/favorites/sync
用客户端收藏列表覆盖服务端当前用户收藏;按 flavor:id 去重,最多 200 个。
{
"favorites": [
{
"id": "123456",
"flavor": "titan",
"regionSlug": "CN",
"serverSlug": "时光",
"serverName": "时光",
"characterName": "Player",
"lastUpdatedAt": 1777449600000
}
]
}