fix(fulfillment): 支持重开未过期支付二维码并展示具体待人工原因

This commit is contained in:
yml
2026-11-28 14:11:21 +08:00
parent 20314a2f1d
commit 2013a9bdeb
9 changed files with 302 additions and 64 deletions
+2
View File
@@ -1026,6 +1026,7 @@ export interface DouyuTaskBatchRequest {
platform_task_id?: number;
recharge_confirmation_token?: string;
force_occupied?: boolean;
reuse_active_payment?: boolean;
}
export interface DouyuOccupiedForceCandidate {
@@ -1050,6 +1051,7 @@ export interface DouyuTaskBatchResult {
account_names?: string[];
requires_force_confirmation?: boolean;
occupied_accounts?: DouyuOccupiedForceCandidate[];
reused?: boolean;
message?: string;
}
@@ -114,10 +114,21 @@ const SALE_MODE_LABELS: Record<string, string> = {
const MANUAL_REASON_LABELS: Record<string, string> = {
points_short: '积分不足',
elite_not_opened: '宝典未开通',
limit_reached: '已达限兑',
binding_failed: '绑定异常',
account_cooldown: '账号冷却',
other_manual: '其他人工',
limit_reached: '已达限兑上限',
binding_failed: '未识别到绑定角色',
binding_verify_failed: '斗鱼绑定复核未通过',
account_role_cooldown: '斗鱼号换绑冷却期',
customer_role_cooldown: '买家绑定角色冷却期',
customer_role_bound_elsewhere: '买家角色7天内已绑其他斗鱼号',
account_role_bound_elsewhere: '斗鱼号7天内已绑其他角色',
role_changed: '扫码角色已失效需重扫',
lease_expired: '账号租约已过期',
lease_expired_collab_handoff: '租约到期已转台账',
account_cooldown: '账号冷却 / 租约过期',
eligibility_check_failed: '兑换资格查询失败',
bundle_co_eligibility_missing: '缺少联合皮肤全资格账号',
manual_required: '需要人工处理',
other_manual: '其他人工处理',
};
const SALE_MODE_TAB_STORAGE_KEY = 'platform_fulfillment_sale_mode_tab';
@@ -197,7 +208,7 @@ const EVENT_LABELS: Record<string, string> = {
const ISSUE_LABELS: Record<string, string> = {
mapping_missing: '商品映射缺失',
no_eligible_account: '没有可分配账号',
bundle_co_eligibility_missing: '没有同时可兑联合皮肤的账号',
bundle_co_eligibility_missing: '缺少联合皮肤全资格账号',
capability_cache_miss: '账号商品能力待补货',
account_lease_conflict: '候选账号正被其他任务占用',
account_pool_busy: '资格账号暂时全部占用',
@@ -210,13 +221,16 @@ const ISSUE_LABELS: Record<string, string> = {
commodity_not_offered: '商品当前未上架',
commodity_status_unknown: '商品资格状态未知',
commodity_not_exchangeable: '商品当前不可兑换',
eligibility_check_failed: '资格查询失败',
binding_failed: '绑定失败',
account_role_cooldown: '斗鱼账号仍在换绑冷却期',
customer_role_cooldown: '游戏角色仍在换绑冷却期',
customer_role_bound_elsewhere: '用户角色 7 天内已绑定其他斗鱼账号',
account_role_bound_elsewhere: '斗鱼账号 7 天内已绑定其他角色',
eligibility_check_failed: '兑换资格查询失败',
binding_failed: '未识别到绑定角色',
binding_verify_failed: '斗鱼绑定复核未通过',
account_role_cooldown: '斗鱼号换绑冷却期',
customer_role_cooldown: '买家绑定角色冷却期',
customer_role_bound_elsewhere: '买家角色7天内已绑其他斗鱼号',
account_role_bound_elsewhere: '斗鱼号7天内已绑其他角色',
role_changed: '扫码角色已失效需重扫',
lease_expired: '账号租约已过期',
lease_expired_collab_handoff: '租约到期已转台账',
manual_required: '需要人工处理',
source_cancelled: '来源订单已取消',
};
@@ -1090,10 +1104,15 @@ export default function PlatformFulfillmentPage() {
concurrency: 1,
payload,
platform_task_id: selected.id,
reuse_active_payment: ['create_elite_qr', 'create_gold_qr'].includes(taskType) || undefined,
});
setDouyuActionType(taskType);
setDouyuActionBatchId(result.batch_id);
message.success(`${DOUYU_ACTION_LABELS[taskType] || '斗鱼任务'}已提交`);
if (result.reused) {
message.info(result.message || '当前已有未过期的支付二维码,已重新打开');
} else {
message.success(`${DOUYU_ACTION_LABELS[taskType] || '斗鱼任务'}已提交`);
}
if (taskType === 'exchange_goods' && selectedId) {
await loadDetail(selectedId, true);
await loadTasks(true);
@@ -1661,11 +1680,36 @@ export default function PlatformFulfillmentPage() {
<Space direction="vertical" size={4}>
<Tag color={STATUS_COLORS[task.executionStatus] || 'default'}>{statusLabel(task.executionStatus)}</Tag>
<Text type="secondary">兑换:{exchangeStatusLabel(task.exchangeStatus)}</Text>
{task.manualReason ? (
<Text type="danger">
{MANUAL_REASON_LABELS[task.manualReason] || task.manualReason}
</Text>
) : null}
{(() => {
const showIssue =
task.executionStatus === 'manual_required'
|| Boolean(task.manualReason)
|| task.bindingStatus === 'failed'
|| (task.executionStatus === 'ready' && Boolean(task.issueCode));
if (!showIssue) return null;
const code =
task.issueCode && task.issueCode !== 'manual_required'
? task.issueCode
: task.manualReason;
const reasonText =
(code && (ISSUE_LABELS[code] || MANUAL_REASON_LABELS[code])) || '';
const genericReason =
!code || ['binding_failed', 'manual_required', 'other_manual'].includes(code);
const displayText =
genericReason && task.lastError
? task.lastError
: reasonText || task.lastError;
if (!displayText) return null;
return (
<Text
type="danger"
ellipsis={{ tooltip: task.lastError || displayText }}
style={{ maxWidth: 164 }}
>
{displayText}
</Text>
);
})()}
</Space>
),
},
@@ -2632,7 +2676,18 @@ export default function PlatformFulfillmentPage() {
</Tag>
<Text>{douyuActionTask.message || '任务执行中'}</Text>
{douyuActionQrValue ? (
<QRCode value={douyuActionQrValue} size={260} />
<>
<QRCode value={douyuActionQrValue} size={260} />
{typeof douyuActionTask.result?.payment_deadline_at === 'string' &&
douyuActionTask.result.payment_deadline_at ? (
<Text type="secondary">
二维码有效期至:{formatTime(douyuActionTask.result.payment_deadline_at)}
</Text>
) : null}
<Text type="secondary" style={{ fontSize: 12 }}>
关闭弹窗不会中断后台到账查询;过期前再次点击按钮可重新打开当前二维码
</Text>
</>
) : null}
{douyuActionType === 'exchange_goods' && douyuActionTask.status === 'success' ? (
<ExchangeResultImage
@@ -1089,6 +1089,8 @@ export default function DouyuTasksPage({
payload,
recharge_confirmation_token: rechargeConfirmationToken,
force_occupied: forceOccupied || undefined,
reuse_active_payment:
ids.length === 1 && DOUYU_PAYMENT_TASK_TYPE_SET.has(taskType) ? true : undefined,
});
if (result.requires_force_confirmation) {
const occupiedRows = result.occupied_accounts || [];