feat(semi-auto): 缺角色ID时引导客户联系客服并拦截确认
This commit is contained in:
@@ -12,7 +12,7 @@ import path from 'node:path'
|
||||
import { runtimeConfig } from '../../../config/runtime.js'
|
||||
import { createHttpError } from '../../../utils/http.js'
|
||||
import { logWarn } from '../../../utils/logger.js'
|
||||
import { resolveBindingRoleId } from '../binding-role-id.js'
|
||||
import { describeBindingRole } from '../binding-role-id.js'
|
||||
import type {
|
||||
ConnectorBindingSession,
|
||||
ConnectorBrowserTicket,
|
||||
@@ -833,8 +833,12 @@ export class HuyaNativeConnector {
|
||||
const hasExistingBinding = hasExistingHuyaBinding(roleResponse)
|
||||
session.binding.hasExistingBinding = hasExistingBinding
|
||||
applyRebindMeta(session, roleResponse, this.now())
|
||||
if (role.role && !options.forceRebind) {
|
||||
this.markRoleReady(session, role, hasExistingBinding && !session.binding.rebindRequested)
|
||||
// 只有平台明确「已绑定」才允许直接确认;没有绑定(即使残留角色名)必须走扫码绑定。
|
||||
if (hasExistingBinding && !options.forceRebind) {
|
||||
this.markRoleReady(session, role, true)
|
||||
if (!role.role) {
|
||||
session.binding.message = '当前账号已有绑定角色,但平台未返回角色信息,请联系客服人工核实'
|
||||
}
|
||||
if (session.binding.rebindRequested) {
|
||||
session.binding.message = session.binding.rebindUnchanged
|
||||
? rebindFailureMessage(
|
||||
@@ -1069,7 +1073,7 @@ export class HuyaNativeConnector {
|
||||
const hasExistingBinding = hasExistingHuyaBinding(response)
|
||||
session.binding.hasExistingBinding = hasExistingBinding
|
||||
applyRebindMeta(session, response, this.now())
|
||||
if (role.role) {
|
||||
if (role.role && hasExistingBinding) {
|
||||
const rebindRequested = session.binding.rebindRequested
|
||||
const roleKey = bindingRoleKey(role)
|
||||
const changedRole =
|
||||
@@ -1112,6 +1116,10 @@ export class HuyaNativeConnector {
|
||||
if (rebindRequested) {
|
||||
session.binding.message = '已识别换绑角色,请确认换绑'
|
||||
}
|
||||
} else if (hasExistingBinding) {
|
||||
// 平台标记已绑定,但没有返回角色信息(或角色ID不可核对):必须人工核实,不能生成二维码。
|
||||
this.markRoleReady(session, role, true)
|
||||
session.binding.message = '当前账号已有绑定角色,但平台未返回角色信息,请联系客服人工核实'
|
||||
} else if (
|
||||
!session.binding.rebindRequested &&
|
||||
session.binding.bindConfirmState === 'rejected'
|
||||
@@ -1449,6 +1457,13 @@ export class HuyaNativeConnector {
|
||||
session.binding.role = role.role
|
||||
session.binding.roleId = role.roleId || ''
|
||||
session.binding.channel = role.channel
|
||||
const roleInfo = describeBindingRole(role.role, role.roleId, session.uid)
|
||||
if (roleInfo.requiresSupport) {
|
||||
session.binding.message = existingBinding
|
||||
? '当前账号已有绑定角色,但未获取到可核对的角色ID,请联系客服人工核实'
|
||||
: '已识别绑定角色,但未获取到可核对的角色ID,请联系客服人工核实'
|
||||
return
|
||||
}
|
||||
session.binding.message = existingBinding
|
||||
? '当前账号已有绑定角色,请确认直接使用'
|
||||
: '绑定角色已识别,请确认绑定'
|
||||
@@ -1526,6 +1541,9 @@ export class HuyaNativeConnector {
|
||||
|
||||
private bindingView(session: NativeSession): ConnectorBindingSession {
|
||||
const binding = session.binding
|
||||
const roleInfo = describeBindingRole(binding.role, binding.roleId, session.uid)
|
||||
const requiresSupport =
|
||||
roleInfo.requiresSupport || (binding.hasExistingBinding === true && !roleInfo.roleIdVerified)
|
||||
return {
|
||||
sessionId: session.sessionId,
|
||||
status: binding.status,
|
||||
@@ -1534,8 +1552,10 @@ export class HuyaNativeConnector {
|
||||
qrUrl: binding.qrUrl,
|
||||
bindGameAccount: binding.account,
|
||||
bindGameRole: binding.role,
|
||||
bindGameRoleId: resolveBindingRoleId(binding.roleId, session.uid),
|
||||
bindGameRoleId: roleInfo.resolvedRoleId,
|
||||
bindGameChannel: binding.channel,
|
||||
roleIdVerified: roleInfo.roleIdVerified,
|
||||
requiresSupport,
|
||||
hasExistingBinding: binding.hasExistingBinding,
|
||||
rebindRequested: binding.rebindRequested,
|
||||
rebindUnchanged: binding.rebindUnchanged,
|
||||
|
||||
Reference in New Issue
Block a user