feat(履约绑定): 支持工作台修改客户资料、扫码不匹配时间线及确认后斗鱼复核

This commit is contained in:
yml
2026-11-26 16:23:30 +08:00
parent ed91fb7549
commit 917c11f203
14 changed files with 1293 additions and 19 deletions
@@ -147,6 +147,28 @@ export const platformFulfillmentApi = {
`/platform-fulfillment/tasks/${taskId}/bind/manual-confirm`,
{ role_name: roleName, note },
),
verifyBinding: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/bind/verify`,
),
updateCustomerProfile: (
taskId: number,
data: {
customerRoleName: string;
customerPlatform: 'wechat' | 'qq';
customerSystem: 'ios' | 'android';
reopenBinding: boolean;
},
) =>
api.patch<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/customer-profile`,
{
customer_role_name: data.customerRoleName,
customer_platform: data.customerPlatform,
customer_system: data.customerSystem,
reopen_binding: data.reopenBinding,
},
),
refreshEligibility: (taskId: number) =>
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
`/platform-fulfillment/tasks/${taskId}/eligibility/refresh`,
+9
View File
@@ -2555,6 +2555,15 @@ export interface PlatformFulfillmentBindingEvidence {
confirmable: boolean;
targetRole: string;
scannedRole: string;
mismatchedRole?: {
alias: string;
roleName: string;
areaName: string;
platName: string;
channel: string;
expectedRoleName: string;
observedAt: string;
} | null;
baselineRole: string;
samePair: boolean;
actionCurrent: PlatformFulfillmentBindingCandidate | null;
@@ -172,6 +172,12 @@ const EVENT_LABELS: Record<string, string> = {
binding_manually_confirmed: '人工确认绑定',
binding_reused_existing_pair: '复用同账号同角色',
binding_sync_rejected: '忽略不匹配的绑定证据',
binding_scanned_role_mismatch: '扫码角色与下单资料不一致',
binding_verified: '斗鱼绑定复核通过',
binding_verify_failed: '斗鱼绑定复核未通过',
binding_verify_error: '斗鱼绑定复核查询异常',
customer_profile_saved: '客户提交游戏资料',
customer_profile_updated: '工作台修改客户资料',
eligibility_check_failed: '兑换资格查询失败',
eligibility_auto_refresh_failed: '自动刷新兑换资格失败',
exchange_eligibility_checked: '刷新兑换资格',
@@ -427,6 +433,34 @@ function eventDescription(event: { eventType: string; detail: Record<string, unk
if (reason === 'missing_target') return '本单没有待确认角色,账号确认任务未结算';
return '该绑定任务不属于当前订单,已忽略';
}
if (event.eventType === 'binding_scanned_role_mismatch') {
const channel = String(detail.channel || '');
return `扫到角色「${String(detail.scannedRoleName || '-')}」${channel ? `(${channel})` : ''},与下单填写「${String(detail.expectedRoleName || '-')}」不一致`;
}
if (event.eventType === 'binding_verified') {
const channel = String(detail.channel || '');
const mode = detail.automatic ? '自动复核' : '人工复核';
return `${mode}通过:斗鱼当前已绑定「${String(detail.roleName || '-')}」${channel ? `(${channel})` : ''}`;
}
if (event.eventType === 'binding_verify_failed') {
return String(detail.message || `斗鱼复核未通过:实际 ${String(detail.actualRoleName || '未生效')},目标 ${String(detail.expectedRoleName || '-')}`);
}
if (event.eventType === 'binding_verify_error') {
return `复核查询斗鱼接口失败:${String(detail.error || '未知错误')}`;
}
if (event.eventType === 'customer_profile_saved') {
const plat = CUSTOMER_PLATFORM_LABELS[String(detail.platform || '')] || String(detail.platform || '-');
const sys = CUSTOMER_SYSTEM_LABELS[String(detail.system || '')] || String(detail.system || '-');
return `客户提交资料:角色 ${String(detail.customerRoleName || '-')}(${plat} / ${sys})`;
}
if (event.eventType === 'customer_profile_updated') {
const plat = CUSTOMER_PLATFORM_LABELS[String(detail.platform || '')] || String(detail.platform || '-');
const sys = CUSTOMER_SYSTEM_LABELS[String(detail.system || '')] || String(detail.system || '-');
const prev = String(detail.previousRoleName || '');
const next = String(detail.customerRoleName || '-');
const roleText = prev && prev !== next ? `${prev} → ${next}` : next;
return `修改客户资料:${roleText}(${plat} / ${sys})${detail.reopenedBinding ? ';已重置失败状态待重扫' : ''}`;
}
if (event.eventType === 'task_created') return '订单已进入直播账号履约工作台';
return '履约状态已更新';
}
@@ -505,6 +539,13 @@ export default function PlatformFulfillmentPage() {
const [manualBindRole, setManualBindRole] = useState('');
const [manualBindNote, setManualBindNote] = useState('');
const [manualBinding, setManualBinding] = useState(false);
const [profileEditTarget, setProfileEditTarget] = useState<PlatformFulfillmentTask | null>(null);
const [profileEditRole, setProfileEditRole] = useState('');
const [profileEditPlatform, setProfileEditPlatform] = useState<'wechat' | 'qq'>('wechat');
const [profileEditSystem, setProfileEditSystem] = useState<'ios' | 'android'>('ios');
const [profileEditReopen, setProfileEditReopen] = useState(true);
const [profileEditSaving, setProfileEditSaving] = useState(false);
const [verifyingBinding, setVerifyingBinding] = useState(false);
const manualBindCurrentRole =
manualBindTarget?.bindingEvidence?.accountCurrentRole || '';
const manualBindMismatch = Boolean(
@@ -969,6 +1010,63 @@ export default function PlatformFulfillmentPage() {
}
};
const openProfileEdit = (task: PlatformFulfillmentTask) => {
setProfileEditTarget(task);
setProfileEditRole(task.customerProfile?.roleName || '');
setProfileEditPlatform(task.customerProfile?.platform === 'qq' ? 'qq' : 'wechat');
setProfileEditSystem(task.customerProfile?.system === 'android' ? 'android' : 'ios');
setProfileEditReopen(task.bindingStatus === 'failed');
};
const saveCustomerProfile = async () => {
if (!profileEditTarget) return;
const role = profileEditRole.trim();
if (!role) {
message.warning('请填写客户游戏角色名');
return;
}
setProfileEditSaving(true);
try {
const result = await platformFulfillmentApi.updateCustomerProfile(
profileEditTarget.id,
{
customerRoleName: role,
customerPlatform: profileEditPlatform,
customerSystem: profileEditSystem,
reopenBinding: profileEditReopen,
},
);
setDetail(result);
setSelectedId(result.task.id);
setProfileEditTarget(null);
await loadTasks();
message.success('客户资料已更新');
} catch (error) {
message.error(getErrorMessage(error));
} finally {
setProfileEditSaving(false);
}
};
const verifyTaskBinding = async (task: PlatformFulfillmentTask) => {
setVerifyingBinding(true);
try {
const result = await platformFulfillmentApi.verifyBinding(task.id);
setDetail(result);
setSelectedId(result.task.id);
await loadTasks();
if (result.task.bindingStatus === 'bound') {
message.success('斗鱼复核通过:当前绑定已生效且角色一致');
} else {
message.warning(result.task.lastError || '斗鱼复核未通过,已转人工处理');
}
} catch (error) {
message.error(getErrorMessage(error));
} finally {
setVerifyingBinding(false);
}
};
const runDouyuAccountAction = async (taskType: string) => {
if (!selected?.account) {
message.warning('当前履约任务还没有分配斗鱼账号');
@@ -1672,6 +1770,19 @@ export default function PlatformFulfillmentPage() {
强制确认
</Button>
) : null}
{selected &&
selected.account &&
selected.bindingStatus === 'bound' &&
!['completed', 'cancelled'].includes(selected.executionStatus) &&
can('platform_fulfillment:use') ? (
<Button
icon={<SyncOutlined />}
loading={verifyingBinding}
onClick={() => void verifyTaskBinding(selected)}
>
复核绑定
</Button>
) : null}
{selected.account &&
selected.executionStatus !== 'completed' &&
selected.executionStatus !== 'cancelled' &&
@@ -1975,7 +2086,19 @@ export default function PlatformFulfillmentPage() {
</Descriptions>
</Card>
<Card size="small" title="用户资料(order_site)">
<Card
size="small"
title="用户资料(order_site)"
extra={
can('platform_fulfillment:use') &&
!['completed', 'cancelled'].includes(selected.executionStatus) &&
selected.bindingStatus !== 'bound' ? (
<Button size="small" onClick={() => openProfileEdit(selected)}>
修改资料
</Button>
) : null
}
>
{selected.customerProfile ? (
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Descriptions bordered size="small" column={2}>
@@ -2129,6 +2252,19 @@ export default function PlatformFulfillmentPage() {
<Descriptions.Item label="本次扫码角色" span={2}>
{selected.bindingEvidence.scannedRole ? (
<Text strong>{selected.bindingEvidence.scannedRole}</Text>
) : selected.bindingEvidence.mismatchedRole ? (
<Space wrap>
<Tag color="red">扫到不匹配角色</Tag>
<Text strong>{selected.bindingEvidence.mismatchedRole.roleName}</Text>
{selected.bindingEvidence.mismatchedRole.channel ? (
<Text type="secondary">{selected.bindingEvidence.mismatchedRole.channel}</Text>
) : null}
{selected.bindingEvidence.mismatchedRole.expectedRoleName ? (
<Text type="secondary">
(下单填写:{selected.bindingEvidence.mismatchedRole.expectedRoleName})
</Text>
) : null}
</Space>
) : (
<Text type="secondary">未扫码(账号已有角色仅作参考)</Text>
)}
@@ -2589,6 +2725,68 @@ export default function PlatformFulfillmentPage() {
</Space>
</Modal>
<Modal
title={`修改用户资料 ${profileEditTarget ? `#${profileEditTarget.id}` : ''}`}
open={Boolean(profileEditTarget)}
okText="保存资料"
cancelText="取消"
confirmLoading={profileEditSaving}
okButtonProps={{ disabled: !profileEditRole.trim() }}
onOk={() => void saveCustomerProfile()}
onCancel={() => setProfileEditTarget(null)}
>
<Space direction="vertical" size={12} style={{ width: '100%' }}>
<Alert
type="info"
showIcon
message="请对照客户主页截图核对并修正"
description="修改后会同步写入时间线和订单侧;若正在扫码中会立即按新角色名重算。"
/>
<div>
<Text strong>客户游戏角色名</Text>
<Input
value={profileEditRole}
maxLength={128}
placeholder="请输入正确游戏角色名"
onChange={(event) => setProfileEditRole(event.target.value)}
style={{ marginTop: 8 }}
/>
</div>
<Row gutter={12}>
<Col span={12}>
<Text strong>登录方式</Text>
<Select
value={profileEditPlatform}
onChange={(value) => setProfileEditPlatform(value)}
style={{ width: '100%', marginTop: 8 }}
options={[
{ value: 'wechat', label: '微信' },
{ value: 'qq', label: 'QQ' },
]}
/>
</Col>
<Col span={12}>
<Text strong>系统</Text>
<Select
value={profileEditSystem}
onChange={(value) => setProfileEditSystem(value)}
style={{ width: '100%', marginTop: 8 }}
options={[
{ value: 'ios', label: '苹果' },
{ value: 'android', label: '安卓' },
]}
/>
</Col>
</Row>
{profileEditTarget?.bindingStatus === 'failed' ? (
<Space align="center">
<Switch checked={profileEditReopen} onChange={setProfileEditReopen} />
<Text>保存后重置绑定失败状态(清空旧报错,便于重新出码扫码)</Text>
</Space>
) : null}
</Space>
</Modal>
<Modal
open={settingsOpen}
title="履约同步与租约设置"