调整(微博绑定): 确认后同样引导截图联系客服,换绑冷却按平台天数并留证

- 客户页抽出统一的「绑定已确认」渲染:标题 + 「请截图本页,把订单号和这张截图发给客服」+
  可复制订单号;虎牙与微博共用同一段文案,删除微博原来的「客服正在安排 / 请耐心等待」。
- 微博换绑冷却:天数只取后端 `rebindCooldownDays`(来自平台 `rebind_remain_days`);
  冷却中且已有绑定角色时禁用「微信绑定 / QQ 绑定」并提示剩余天数,
  「刷新角色状态」不受影响。
- 微博绑定失败原因改为常驻展示(平台原因 + 任务 lastError 去重),
  冷却拒绝不再只弹一个瞬时 toast。
- 后端补留证:微博换绑被平台冷却拒绝时写 `last_error` 并追加
  `weibo_binding_rejected` 事件(channel + 原因),便于客服排障。
- 权威文档补微博第 ⑥ 条:冷却天数只认平台、拒绝需留证、确认后直接引导截图联系客服。
- 测试:新增微博冷却与共用渲染断言(前端 491 全绿),后端补微博留证回归断言(1552 全绿)。
This commit is contained in:
yml
2026-12-02 11:23:33 +08:00
parent 0314955f9b
commit 7d7a996f7d
6 changed files with 278 additions and 96 deletions
@@ -66,6 +66,22 @@ const SERVER_ZONE_OPTIONS = CUSTOMER_SERVER_ZONE_OPTIONS
/** antd v6 语义化 classNames:让区服下拉弹层用页面深色样式 */
const SERVER_ZONE_SELECT_CLASS_NAMES = { popup: { root: 'customer-collect-dropdown' } }
/**
* 绑定失败原因去重收集:平台原因、任务 lastError、本次请求抛错可能说的是同一句话,
* 只按出现顺序保留第一次,空值直接丢弃。
*/
function collectBindingFailureReasons(values: Array<string | null | undefined>) {
const seen = new Set<string>()
const reasons: string[] = []
for (const value of values) {
const text = String(value || '').trim()
if (!text || seen.has(text)) continue
seen.add(text)
reasons.push(text)
}
return reasons
}
export default function CustomerFulfillmentPage({
expectedPlatform,
}: {
@@ -996,6 +1012,42 @@ export default function CustomerFulfillmentPage({
}
}
/**
* 「确认绑定成功」后两个平台必须给出同一段引导:同一段 JSX,只换刷新按钮的文案和动作。
* 客户不需要猜下一步——直接截图本页连订单号一起发给客服。
*/
const renderBindingConfirmedNotice = (options: {
refreshLabel: string
onRefresh: () => void
}) => (
<div className="customer-binding-verify">
<p className="customer-binding-verify-title">绑定已确认</p>
<p className="customer-binding-verify-desc">
请截图本页,把订单号和这张截图发给客服,客服会按截图核对并继续处理。
</p>
<div className="customer-binding-order-no">
<span>订单号</span>
<strong>{orderNo || selectedTask?.orderNo || ''}</strong>
<Button
size="small"
icon={<CopyOutlined />}
onClick={() => void copyOrderNoForSupport('订单号已复制,请连同截图一起发给客服')}
>
复制订单号
</Button>
</div>
<Button
block
size="large"
className="customer-login-alt"
loading={bindingLoading}
onClick={options.onRefresh}
>
{options.refreshLabel}
</Button>
</div>
)
const displayTitle = isWeibo ? '登录并绑定微博游戏角色' : '绑定游戏角色'
const loginQrVisible =
Boolean(selectedTask) && ['qr_pending', 'scanned'].includes(selectedTask.loginStatus)
@@ -1077,31 +1129,36 @@ export default function CustomerFulfillmentPage({
const rebindCooldownDays = Number(bindingInfo?.rebindCooldownDays || 0)
const rebindCooldownText =
rebindCooldownDays > 0 ? `当前仍处于虎牙换绑冷却期,剩余约 ${rebindCooldownDays} 天` : ''
// 微博页不涉及虎牙,冷却口径相同但文案不写虎牙。
const weiboRebindCooldownText =
rebindCooldownDays > 0 ? `当前角色仍在换绑冷却期,剩余约 ${rebindCooldownDays} 天` : ''
// 微博页不涉及虎牙,冷却口径相同但文案不写虎牙。天数只认后端 rebindCooldownDays:
// 平台在「还没有绑定角色」时允许首次绑定,这种场景不算冷却,按钮必须保持可用。
const weiboBoundRoleName = String(
bindingInfo?.bindGameRole || selectedTask?.bindGameRole || '',
).trim()
const weiboRebindCooldownBlocked = rebindCooldownDays > 0 && Boolean(weiboBoundRoleName)
const weiboRebindCooldownText = weiboRebindCooldownBlocked
? `当前角色仍在换绑冷却期,剩余约 ${rebindCooldownDays} 天,冷却结束后才能换绑`
: ''
// 虎牙账号/目标角色仍在换绑冷却期:后端已不再给「重新扫码换绑」,页面只提供只读刷新。
const isRebindBlocked =
bindingDecision?.flowState === 'rebind_blocked_account' ||
bindingDecision?.flowState === 'rebind_blocked_target_role'
const canRefreshBindingState = decisionCanRefreshBinding || isRebindBlocked
// 失败原因按「平台确认原因 → 任务原因 → 决策消息」去重,同一句只打印一次。
const bindingFailureReasons = (() => {
const seen = new Set<string>()
const reasons: string[] = []
const push = (value: string | null | undefined) => {
const text = String(value || '').trim()
if (!text || seen.has(text)) return
seen.add(text)
reasons.push(text)
}
push(bindingInfo?.bindConfirmMessage)
push(selectedTask?.bindConfirmMessage)
push(bindingInfo?.rebindConfirmMessage)
push(bindingDecision?.message)
push(selectedTask?.lastError)
return reasons
})()
const bindingFailureReasons = collectBindingFailureReasons([
bindingInfo?.bindConfirmMessage,
selectedTask?.bindConfirmMessage,
bindingInfo?.rebindConfirmMessage,
bindingDecision?.message,
selectedTask?.lastError,
])
// 微博绑定区同一口径:任务 lastError 已在 bindingFailureReasons 里,
// 这里再补上本次请求抛错(例如换绑冷却拒绝)与平台给出的失败消息,
// 保证它们留在页面上的展示位,而不是只弹一条会消失的 toast。
const weiboBindingFailureReasons = collectBindingFailureReasons([
...bindingFailureReasons,
bindingLoadError,
selectedTask?.bindingStatus === 'failed' ? bindingInfo?.message : '',
])
// 只有角色名缺失时才需要人工核实;加密 role token 不再冒充客户游戏角色 UID。
const bindingRequiresSupport = Boolean(
bindingDecision?.requiresSupport || bindingInfo?.requiresSupport,
@@ -1570,6 +1627,25 @@ export default function CustomerFulfillmentPage({
</div>
</div>
) : null}
{/* 失败原因与虎牙同一口径:平台原因 + 任务 lastError + 本次请求抛错,去重后逐条展示。 */}
{weiboBindingFailureReasons.length ? (
<Alert
type="error"
showIcon
message="绑定未成功,原因如下"
description={
<Space direction="vertical" size={2}>
{weiboBindingFailureReasons.map((reason) => (
<span key={reason}>{reason}</span>
))}
</Space>
}
/>
) : null}
{/* 冷却提示放在绑定按钮上方:天数只来自后端 rebindCooldownDays。 */}
{weiboRebindCooldownText ? (
<Alert type="warning" showIcon message={weiboRebindCooldownText} />
) : null}
{bindingInfo?.qrImage ? (
<div className="customer-binding-qr-card">
<Image
@@ -1602,23 +1678,13 @@ export default function CustomerFulfillmentPage({
description="请重新选择微信或 QQ 获取新的绑定二维码。"
/>
) : null}
{bindingLoadError ? (
<Alert
type="error"
showIcon
message={bindingLoadError}
description={bindingInfo?.message}
/>
) : selectedTask.bindingStatus === 'failed' && bindingInfo?.message ? (
<Alert type="error" showIcon message={bindingInfo.message} />
) : null}
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Button
block
size="large"
type="primary"
loading={bindingLoading}
disabled={bindingSessionExpired}
disabled={bindingSessionExpired || weiboRebindCooldownBlocked}
onClick={() => void handleStartWeiboBinding('wx')}
>
微信绑定
@@ -1627,11 +1693,12 @@ export default function CustomerFulfillmentPage({
block
size="large"
loading={bindingLoading}
disabled={bindingSessionExpired}
disabled={bindingSessionExpired || weiboRebindCooldownBlocked}
onClick={() => void handleStartWeiboBinding('qq')}
>
QQ 绑定
</Button>
{/* 「刷新角色状态」始终可用:冷却只限制换绑,不限制查看当前角色。 */}
<Button
block
size="large"
@@ -1645,9 +1712,6 @@ export default function CustomerFulfillmentPage({
</Space>
</div>
)}
{weiboRebindCooldownText ? (
<Alert type="info" showIcon message={weiboRebindCooldownText} />
) : null}
</section>
) : null}
@@ -2046,61 +2110,28 @@ export default function CustomerFulfillmentPage({
</Space>
) : null}
{bindingDecision?.flowState === 'confirmed' && !profileEditing ? (
<div className="customer-binding-verify">
<p className="customer-binding-verify-title">绑定已确认</p>
<p className="customer-binding-verify-desc">
请截图本页,把订单号和这张截图发给客服,客服会按截图核对并继续处理。
</p>
<div className="customer-binding-order-no">
<span>订单号</span>
<strong>{orderNo || selectedTask?.orderNo || ''}</strong>
<Button
size="small"
icon={<CopyOutlined />}
onClick={() =>
void copyOrderNoForSupport('订单号已复制,请连同截图一起发给客服')
}
>
复制订单号
</Button>
</div>
<Button
block
size="large"
className="customer-login-alt"
loading={bindingLoading}
onClick={() => {
{bindingDecision?.flowState === 'confirmed' && !profileEditing
? renderBindingConfirmedNotice({
refreshLabel: '刷新订单状态',
onRefresh: () => {
setBindingLoading(true)
void load(true).finally(() => setBindingLoading(false))
}}
>
刷新订单状态
</Button>
</div>
) : null}
},
})
: null}
</section>
) : null}
{/* 微博确认后的引导与虎牙完全同一段渲染,只换刷新文案。 */}
{isWeibo &&
selectedTask?.loginStatus === 'authenticated' &&
selectedTask.bindingStatus === 'confirmed' &&
selectedTask.executionStatus !== 'completed' ? (
<div className="customer-auth-state is-waiting">
<div className="customer-auth-state-icon">
<LoadingOutlined spin />
</div>
<h2>客服正在安排</h2>
<p>请耐心等待</p>
<Button
className="customer-auth-secondary-button"
icon={<ReloadOutlined />}
onClick={() => void load()}
>
刷新状态
</Button>
</div>
) : null}
selectedTask.executionStatus !== 'completed'
? renderBindingConfirmedNotice({
refreshLabel: '刷新状态',
onRefresh: () => void load(),
})
: null}
<HuyaChallengeModal
open={Boolean(huyaChallenge)}