fix(douyu): 保留账号并刷新过期二维码
This commit is contained in:
@@ -178,10 +178,10 @@ export default function AdminDouyuFulfillmentPage() {
|
|||||||
const restartMutation = useMutation({
|
const restartMutation = useMutation({
|
||||||
mutationFn: restartAdminDouyuBinding,
|
mutationFn: restartAdminDouyuBinding,
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
message.success('已重新生成绑定二维码')
|
message.success('二维码已刷新;仍在有效期时会复用当前二维码')
|
||||||
await refreshAll()
|
await refreshAll()
|
||||||
},
|
},
|
||||||
onError: (error) => message.error(error instanceof Error ? error.message : '重新生成失败'),
|
onError: (error) => message.error(error instanceof Error ? error.message : '刷新二维码失败'),
|
||||||
})
|
})
|
||||||
|
|
||||||
async function copyLink(task: DouyuFulfillmentTask) {
|
async function copyLink(task: DouyuFulfillmentTask) {
|
||||||
@@ -270,9 +270,9 @@ export default function AdminDouyuFulfillmentPage() {
|
|||||||
size="small"
|
size="small"
|
||||||
icon={<ReloadOutlined />}
|
icon={<ReloadOutlined />}
|
||||||
loading={refreshMutation.isPending}
|
loading={refreshMutation.isPending}
|
||||||
onClick={() => refreshMutation.mutate(task.platform_order_id)}
|
onClick={() => restartMutation.mutate(task.platform_order_id)}
|
||||||
>
|
>
|
||||||
刷新绑定
|
刷新二维码
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
@@ -421,7 +421,7 @@ export default function AdminDouyuFulfillmentPage() {
|
|||||||
loading={refreshMutation.isPending}
|
loading={refreshMutation.isPending}
|
||||||
onClick={() => refreshMutation.mutate(detail.task.platform_order_id)}
|
onClick={() => refreshMutation.mutate(detail.task.platform_order_id)}
|
||||||
>
|
>
|
||||||
刷新绑定
|
同步状态
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -429,7 +429,7 @@ export default function AdminDouyuFulfillmentPage() {
|
|||||||
loading={restartMutation.isPending}
|
loading={restartMutation.isPending}
|
||||||
onClick={() => restartMutation.mutate(detail.task.platform_order_id)}
|
onClick={() => restartMutation.mutate(detail.task.platform_order_id)}
|
||||||
>
|
>
|
||||||
重新生成二维码
|
刷新二维码
|
||||||
</Button>
|
</Button>
|
||||||
<Button icon={<LinkOutlined />} href={detail.linkPath} target="_blank">
|
<Button icon={<LinkOutlined />} href={detail.linkPath} target="_blank">
|
||||||
打开客户页
|
打开客户页
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ export default function DouyuFulfillmentPage() {
|
|||||||
const live = data?.live
|
const live = data?.live
|
||||||
const needsProfile = Boolean(task && !task.customer_role_name)
|
const needsProfile = Boolean(task && !task.customer_role_name)
|
||||||
const bindingFailed = Boolean(live && BINDING_FAILURE_ISSUES.has(live.issueCode))
|
const bindingFailed = Boolean(live && BINDING_FAILURE_ISSUES.has(live.issueCode))
|
||||||
|
const bindingFailureRetryable = Boolean(live?.issueCode === 'binding_failed' && live.accountReady)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const url = live?.qrUrl || ''
|
const url = live?.qrUrl || ''
|
||||||
@@ -206,7 +207,9 @@ export default function DouyuFulfillmentPage() {
|
|||||||
? '当前斗鱼账号暂不可换绑,本次绑定未生效。'
|
? '当前斗鱼账号暂不可换绑,本次绑定未生效。'
|
||||||
: live?.issueCode === 'customer_role_cooldown'
|
: live?.issueCode === 'customer_role_cooldown'
|
||||||
? '该游戏角色仍处于换绑冷却期,本次绑定未生效。'
|
? '该游戏角色仍处于换绑冷却期,本次绑定未生效。'
|
||||||
: '本次游戏角色绑定失败。'
|
: live?.issueCode === 'binding_failed'
|
||||||
|
? '二维码已过期或未识别到绑定角色,当前斗鱼账号会保留。'
|
||||||
|
: '本次游戏角色绑定失败。'
|
||||||
const bindingDescription = live?.bindConfirmed
|
const bindingDescription = live?.bindConfirmed
|
||||||
? '角色绑定已完成,待客服处理。'
|
? '角色绑定已完成,待客服处理。'
|
||||||
: live?.bindReadyForConfirm
|
: live?.bindReadyForConfirm
|
||||||
@@ -275,19 +278,6 @@ export default function DouyuFulfillmentPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshStatus() {
|
|
||||||
setBindingLoading(true)
|
|
||||||
try {
|
|
||||||
const response = await refreshDouyuBinding(orderNo)
|
|
||||||
applyData(response.data)
|
|
||||||
message.success('绑定状态已刷新')
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error instanceof Error ? error.message : '刷新绑定状态失败')
|
|
||||||
} finally {
|
|
||||||
setBindingLoading(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function confirmBinding() {
|
async function confirmBinding() {
|
||||||
setBindingLoading(true)
|
setBindingLoading(true)
|
||||||
try {
|
try {
|
||||||
@@ -435,12 +425,27 @@ export default function DouyuFulfillmentPage() {
|
|||||||
{bindingFailed ? (
|
{bindingFailed ? (
|
||||||
<div className="customer-douyu-binding-failure">
|
<div className="customer-douyu-binding-failure">
|
||||||
<Alert
|
<Alert
|
||||||
type="error"
|
type={bindingFailureRetryable ? 'warning' : 'error'}
|
||||||
showIcon
|
showIcon
|
||||||
message="角色绑定失败"
|
message={bindingFailureRetryable ? '二维码已过期' : '角色绑定失败'}
|
||||||
description={bindingFailureMessage}
|
description={bindingFailureMessage}
|
||||||
/>
|
/>
|
||||||
<p>请截图本页面并联系客服处理,客服会根据截图重新安排绑定。</p>
|
<p>
|
||||||
|
{bindingFailureRetryable
|
||||||
|
? '请刷新二维码后重新扫码,不会更换当前斗鱼账号。'
|
||||||
|
: '请截图本页面并联系客服处理,客服会根据截图重新安排绑定。'}
|
||||||
|
</p>
|
||||||
|
{bindingFailureRetryable ? (
|
||||||
|
<Button
|
||||||
|
block
|
||||||
|
size="large"
|
||||||
|
icon={<ReloadOutlined />}
|
||||||
|
loading={bindingLoading}
|
||||||
|
onClick={() => void startBinding(true)}
|
||||||
|
>
|
||||||
|
刷新二维码
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Alert
|
<Alert
|
||||||
@@ -478,7 +483,7 @@ export default function DouyuFulfillmentPage() {
|
|||||||
<div className="customer-douyu-qr-preparing-copy">
|
<div className="customer-douyu-qr-preparing-copy">
|
||||||
<Spin />
|
<Spin />
|
||||||
<strong>正在生成二维码</strong>
|
<strong>正在生成二维码</strong>
|
||||||
<span>系统会自动刷新,请稍候</span>
|
<span>系统会自动准备;长时间未生成时可手动刷新</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -494,9 +499,9 @@ export default function DouyuFulfillmentPage() {
|
|||||||
size="large"
|
size="large"
|
||||||
className="customer-douyu-preparing-button"
|
className="customer-douyu-preparing-button"
|
||||||
loading={bindingLoading}
|
loading={bindingLoading}
|
||||||
onClick={() => void refreshStatus()}
|
onClick={() => void startBinding(true)}
|
||||||
>
|
>
|
||||||
刷新状态
|
刷新二维码
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ const backendRoute = readFileSync(
|
|||||||
'utf8',
|
'utf8',
|
||||||
)
|
)
|
||||||
|
|
||||||
test('斗鱼准备阶段只刷新状态,不自动重复开始绑定', () => {
|
test('斗鱼准备阶段允许客户手动刷新二维码,但不自动重复开始绑定', () => {
|
||||||
assert.ok(!page.includes('autoStartRef'))
|
assert.ok(!page.includes('autoStartRef'))
|
||||||
assert.ok(!page.includes('void startDouyuBinding(orderNo)'))
|
assert.ok(!page.includes('void startDouyuBinding(orderNo)'))
|
||||||
assert.ok(page.includes('async function refreshStatus()'))
|
const preparingCard = page.slice(page.indexOf('customer-douyu-preparing-button'))
|
||||||
assert.ok(page.includes('onClick={() => void refreshStatus()}'))
|
assert.ok(preparingCard.includes('onClick={() => void startBinding(true)}'))
|
||||||
assert.ok(page.includes('刷新状态'))
|
assert.ok(preparingCard.includes('刷新二维码'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('刷新二维码前先同步权威状态,有效二维码直接复用', () => {
|
test('刷新二维码前先同步权威状态,有效二维码直接复用', () => {
|
||||||
@@ -32,10 +32,10 @@ test('刷新二维码前先同步权威状态,有效二维码直接复用', ()
|
|||||||
assert.ok(body.includes('二维码仍在有效期内,已复用当前二维码'))
|
assert.ok(body.includes('二维码仍在有效期内,已复用当前二维码'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('客户刷新状态走独立接口,不复用绑定启动接口', () => {
|
test('客户手动刷新二维码走幂等绑定启动接口', () => {
|
||||||
assert.ok(frontendService.includes('/binding/refresh'))
|
assert.ok(frontendService.includes('/binding/start'))
|
||||||
assert.ok(backendRoute.includes("'/:orderNo/binding/refresh'"))
|
assert.ok(backendRoute.includes("'/:orderNo/binding/start'"))
|
||||||
assert.ok(backendRoute.includes('refreshDouyuCustomerBinding'))
|
assert.ok(backendRoute.includes('startDouyuCustomerBinding'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('斗鱼领取页顶部保留 KV,不再展示领取标题', () => {
|
test('斗鱼领取页顶部保留 KV,不再展示领取标题', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user