feat(framework): config 调试登录账号进 profile(DebugAccount)

- DebugProfile 加 account?: DebugAccount(openid 等登录字段,仅 debug 模式生效)
- resolveBootstrap 结果加 account:debug 取 profile.account,release 恒 undefined
- staging profile 留占位 account 待填真值;接入处 setIdentity 合并 identity+account
- 同步指南

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 19:57:41 +08:00
co-authored by Claude Opus 4.8
parent 51a4ee57ac
commit d461578d6e
4 changed files with 46 additions and 4 deletions
+9 -1
View File
@@ -167,8 +167,13 @@ interface DebugProfile {
server?: string; // 显式 ws 调试服地址;给定则跳过远程抓取
gameserver?: string; // 远程配置 txt URL(不含防缓存串)
identity?: Partial<ChannelIdentity>; // 调试用渠道身份覆盖
account?: DebugAccount; // 调试用登录账号(openid 等),仅 debug 模式生效
isDebugger?: boolean; // 收发包日志开关
}
// DebugAccount:player_login 中除渠道身份外的字段(openid 必填,其余可选)
// { openid, nickname?, avatar?, sex?, province?, city?, unionid? }
// 联调账号写在这里(profile 是唯一权威来源),不要散在调试脚本里。
```
### 内置档位(`config/profiles.ts`)
@@ -313,6 +318,7 @@ interface BootstrapOptions {
interface BootstrapResult {
identity: ChannelIdentity;
account?: DebugAccount; // 调试登录账号(仅 debug 模式有值;release 恒 undefined)
servers: string[];
rawConfig: RemoteConfig | null; // 直连档位为 null
profile: DebugProfile;
@@ -352,9 +358,11 @@ async function startup() {
});
// 渠道身份 + 玩家档案合并成完整 player_login 数据
// debug:玩家档案来自 result.account(profile 里配的调试账号,单一权威来源)
// release:result.account 为 undefined,玩家档案由 platform 层/原生提供(后续 Plan)
net.setIdentity({
...result.identity, // agentid/channelid/gameid/marketid/version...
openid, nickname, avatar, sex, province, city, unionid, // 来自登录/微信信息
...(result.account ?? {}), // openid/nickname/avatar/... 调试账号或平台层登录信息
});
net.on('login', (data) => { /* 解析 parseLoginResponse(data) */ });