完善虎牙已有绑定角色确认与重新扫码换绑流程

This commit is contained in:
yml2213
2026-11-10 13:20:51 +08:00
parent a9937ef8c6
commit 08c3834a1c
11 changed files with 287 additions and 41 deletions
@@ -38,6 +38,8 @@ export type ConnectorBindingSession = {
bindGameAccount: string
bindGameRole: string
bindGameChannel: string
hasExistingBinding?: boolean
rebindRequested?: boolean
message: string
}
@@ -219,11 +221,17 @@ export async function getHuyaLoginSession(
export async function startHuyaBinding(
sessionId: string,
mode: SemiAutoConnectorMode = defaultSemiAutoConnectorMode(),
options: { forceRebind?: boolean } = {},
): Promise<ConnectorBindingSession> {
if (mode === 'embedded') return huyaNativeConnector.startBinding(sessionId)
if (mode === 'embedded') {
return huyaNativeConnector.startBinding(
sessionId,
options.forceRebind ? { forceRebind: true } : {},
)
}
return callConnector<ConnectorBindingSession>(
`/api/internal/huya-semi-auto/sessions/${encodeURIComponent(sessionId)}/binding`,
{ method: 'POST', body: {} },
{ method: 'POST', body: { force_rebind: Boolean(options.forceRebind) } },
mode,
)
}