fix(douyu): 完善绑定失败处理与本地开发日志
- 捕获斗鱼账号及客户游戏角色的换绑冷却失败 - 客户页失败后展示截图联系客服提示 - dev.sh 默认跟踪容器日志并补充日志命令入口
This commit is contained in:
@@ -69,8 +69,9 @@ docker compose -f docker-compose.dev.yml down
|
||||
`order_site` 根目录提供 `./dev.sh` 快捷入口。默认直接启动源码挂载开发环境:
|
||||
|
||||
```bash
|
||||
./dev.sh # 启动/更新 dev 环境
|
||||
./dev.sh logs # 跟踪全部 dev 日志
|
||||
./dev.sh # 启动/更新并直接跟踪应用日志
|
||||
./dev.sh up # 只启动/更新,不占用终端
|
||||
./dev.sh logs # 跟踪 backend / frontend / web 日志
|
||||
./dev.sh logs frontend # 只看 Vite HMR 日志
|
||||
./dev.sh logs backend # 只看后端热重载日志
|
||||
./dev.sh ps # 查看 dev 容器
|
||||
|
||||
@@ -25,6 +25,11 @@ import type {
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
|
||||
const POLL_INTERVAL_MS = 3000
|
||||
const BINDING_FAILURE_ISSUES = new Set([
|
||||
'binding_failed',
|
||||
'account_role_cooldown',
|
||||
'customer_role_cooldown',
|
||||
])
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
waiting_profile: '等待填写资料',
|
||||
@@ -116,9 +121,11 @@ export default function DouyuFulfillmentPage() {
|
||||
const task = data?.task
|
||||
const live = data?.live
|
||||
const needsProfile = Boolean(task && !task.customer_role_name)
|
||||
const bindingFailed = Boolean(live && BINDING_FAILURE_ISSUES.has(live.issueCode))
|
||||
const activeBinding = Boolean(
|
||||
task &&
|
||||
!needsProfile &&
|
||||
!bindingFailed &&
|
||||
!['completed', 'cancelled'].includes(task.status) &&
|
||||
!live?.bindConfirmed,
|
||||
)
|
||||
@@ -201,19 +208,27 @@ export default function DouyuFulfillmentPage() {
|
||||
const waitingForSupport = Boolean(
|
||||
task && (live?.bindConfirmed || task.status === 'waiting_operator' || task.status === 'bound'),
|
||||
)
|
||||
const bindingFailureMessage =
|
||||
live?.issueCode === 'account_role_cooldown'
|
||||
? '当前斗鱼账号暂不可换绑,本次绑定未生效。'
|
||||
: live?.issueCode === 'customer_role_cooldown'
|
||||
? '该游戏角色仍处于换绑冷却期,本次绑定未生效。'
|
||||
: '本次游戏角色绑定失败。'
|
||||
const bindingDescription = live?.bindConfirmed
|
||||
? '角色绑定已完成,待客服处理。'
|
||||
: live?.bindReadyForConfirm
|
||||
? '已识别游戏角色,请核对并确认绑定。'
|
||||
: qrExpired
|
||||
? '当前二维码已过期,请刷新二维码后重新扫码。'
|
||||
: live?.issueCode === 'binding_failed'
|
||||
? '暂未识别到绑定角色,请继续使用当前二维码完成扫码。'
|
||||
: !live?.accountReady
|
||||
? '系统正在自动准备账号和二维码,请稍候,无需重复操作。'
|
||||
: live?.qrUrl
|
||||
? '必须使用微信扫码。请选择与资料一致的和平精英角色,QQ 扫码或其他方式无效。'
|
||||
: live?.message || '正在准备绑定二维码,请稍候。'
|
||||
: bindingFailed
|
||||
? bindingFailureMessage
|
||||
: qrExpired
|
||||
? '当前二维码已过期,请刷新二维码后重新扫码。'
|
||||
: live?.issueCode === 'binding_failed'
|
||||
? '暂未识别到绑定角色,请继续使用当前二维码完成扫码。'
|
||||
: !live?.accountReady
|
||||
? '系统正在自动准备账号和二维码,请稍候,无需重复操作。'
|
||||
: live?.qrUrl
|
||||
? '必须使用微信扫码。请选择与资料一致的和平精英角色,QQ 扫码或其他方式无效。'
|
||||
: live?.message || '正在准备绑定二维码,请稍候。'
|
||||
const bindingStageTitle =
|
||||
task?.status === 'qr_pending' && live?.qrUrl
|
||||
? '必须使用微信扫码绑定'
|
||||
@@ -330,7 +345,9 @@ export default function DouyuFulfillmentPage() {
|
||||
return (
|
||||
<CustomerFrame
|
||||
title="斗鱼精英宝典领取"
|
||||
compact={Boolean(live?.qrUrl && !live.bindReadyForConfirm && !live.bindConfirmed)}
|
||||
compact={Boolean(
|
||||
live?.qrUrl && !live.bindReadyForConfirm && !live.bindConfirmed && !bindingFailed,
|
||||
)}
|
||||
>
|
||||
<OrderCard data={data} />
|
||||
|
||||
@@ -388,15 +405,27 @@ export default function DouyuFulfillmentPage() {
|
||||
</section>
|
||||
) : (
|
||||
<section className="customer-binding-stage">
|
||||
<Alert
|
||||
className={live?.qrUrl ? 'customer-douyu-binding-alert is-wechat' : undefined}
|
||||
type={qrExpired ? 'warning' : live?.bindConfirmed ? 'success' : 'info'}
|
||||
showIcon
|
||||
message={bindingStageTitle}
|
||||
description={bindingDescription}
|
||||
/>
|
||||
{bindingFailed ? (
|
||||
<div className="customer-douyu-binding-failure">
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
message="角色绑定失败"
|
||||
description={bindingFailureMessage}
|
||||
/>
|
||||
<p>请截图本页面并联系客服处理,客服会根据截图重新安排绑定。</p>
|
||||
</div>
|
||||
) : (
|
||||
<Alert
|
||||
className={live?.qrUrl ? 'customer-douyu-binding-alert is-wechat' : undefined}
|
||||
type={qrExpired ? 'warning' : live?.bindConfirmed ? 'success' : 'info'}
|
||||
showIcon
|
||||
message={bindingStageTitle}
|
||||
description={bindingDescription}
|
||||
/>
|
||||
)}
|
||||
|
||||
{canRevealBindingQr ? (
|
||||
{!bindingFailed && canRevealBindingQr ? (
|
||||
<Button
|
||||
className="customer-binding-qr-toggle"
|
||||
icon={<QrcodeOutlined />}
|
||||
@@ -406,7 +435,10 @@ export default function DouyuFulfillmentPage() {
|
||||
</Button>
|
||||
) : null}
|
||||
|
||||
{!live?.qrUrl && task.status !== 'completed' ? (
|
||||
{!bindingFailed &&
|
||||
!live?.qrUrl &&
|
||||
!live?.bindReadyForConfirm &&
|
||||
task.status !== 'completed' ? (
|
||||
<div className="customer-binding-qr-card customer-douyu-preparing-card">
|
||||
<h3>游戏角色绑定二维码</h3>
|
||||
<div className="customer-douyu-qr-main">
|
||||
@@ -442,7 +474,7 @@ export default function DouyuFulfillmentPage() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{live?.qrUrl && showBindingQr ? (
|
||||
{!bindingFailed && live?.qrUrl && showBindingQr ? (
|
||||
<div className="customer-binding-qr-card">
|
||||
<h3>游戏角色绑定二维码</h3>
|
||||
<div className="customer-douyu-qr-main">
|
||||
@@ -497,7 +529,7 @@ export default function DouyuFulfillmentPage() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{live?.bindReadyForConfirm ? (
|
||||
{!bindingFailed && live?.bindReadyForConfirm ? (
|
||||
<div className="customer-binding-qr-card">
|
||||
<h3>核对绑定角色</h3>
|
||||
<p className="customer-binding-qr-hint">
|
||||
|
||||
@@ -3249,6 +3249,24 @@
|
||||
color: #ff8a92;
|
||||
}
|
||||
|
||||
.customer-douyu-binding-failure {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.customer-douyu-binding-failure > p {
|
||||
margin: 0;
|
||||
padding: 12px 14px;
|
||||
color: #fecaca;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
text-align: center;
|
||||
border: 1px solid rgba(248, 113, 113, 0.3);
|
||||
border-radius: 10px;
|
||||
background: rgba(127, 29, 29, 0.18);
|
||||
}
|
||||
|
||||
.customer-auth-page.is-douyu.is-compact {
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
|
||||
@@ -3,6 +3,12 @@ set -Eeuo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
COMPOSE_FILE="${ROOT_DIR}/docker-compose.dev.yml"
|
||||
LOG_TAIL="${DEV_LOG_TAIL:-120}"
|
||||
|
||||
follow_app_logs() {
|
||||
printf '\n[dev] 跟踪 backend / frontend / web 日志(Ctrl+C 只退出日志,不停止容器)\n'
|
||||
docker compose -f "${COMPOSE_FILE}" logs -f --tail="${LOG_TAIL}" backend frontend web
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
up|start)
|
||||
@@ -10,7 +16,10 @@ case "${1:-}" in
|
||||
;;
|
||||
logs)
|
||||
shift
|
||||
exec docker compose -f "${COMPOSE_FILE}" logs -f --tail=200 "$@"
|
||||
if [[ $# -eq 0 ]]; then
|
||||
set -- backend frontend web
|
||||
fi
|
||||
exec docker compose -f "${COMPOSE_FILE}" logs -f --tail="${LOG_TAIL}" "$@"
|
||||
;;
|
||||
down|stop)
|
||||
exec docker compose -f "${COMPOSE_FILE}" down
|
||||
@@ -18,6 +27,10 @@ case "${1:-}" in
|
||||
ps|status)
|
||||
exec docker compose -f "${COMPOSE_FILE}" ps
|
||||
;;
|
||||
"")
|
||||
bash "${ROOT_DIR}/deploy/mac-dev.sh"
|
||||
follow_app_logs
|
||||
;;
|
||||
*)
|
||||
exec bash "${ROOT_DIR}/deploy/mac-dev.sh" "$@"
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user