feat(fulfillment): 区分普通代确认与人工强制确认
- 普通代确认走 refresh_binding + actBind,不填角色/备注 - 强制确认保留角色+依据,并校验账号当前角色一致 - 前端拆成“代客户确认”和红色“强制确认” - 补充普通代确认/角色不匹配回归测试与文档
This commit is contained in:
@@ -465,6 +465,29 @@ async def confirm_binding(
|
||||
return result
|
||||
|
||||
|
||||
@router.post("/tasks/{task_id}/bind/operator-confirm")
|
||||
def operator_confirm_binding(
|
||||
task_id: int,
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("platform_fulfillment:use")),
|
||||
) -> dict[str, Any]:
|
||||
"""普通人工代确认:客户已扫码但没点确认,运营代为提交正常 actBind。"""
|
||||
result = service.operator_confirm_binding_sync(
|
||||
db,
|
||||
task_id=task_id,
|
||||
current=current,
|
||||
)
|
||||
record_audit(
|
||||
db,
|
||||
current,
|
||||
action="platform_fulfillment:binding:operator_confirm",
|
||||
target=f"platform_fulfillment_task:{task_id}",
|
||||
detail={"bindingStatus": result.get("task", {}).get("bindingStatus")},
|
||||
)
|
||||
db.commit()
|
||||
return result
|
||||
|
||||
|
||||
@router.post("/tasks/{task_id}/bind/manual-confirm")
|
||||
def manual_confirm_binding(
|
||||
task_id: int,
|
||||
|
||||
@@ -598,6 +598,35 @@ def _mark_reused_pair(
|
||||
return True
|
||||
|
||||
|
||||
def operator_confirm_binding_sync(
|
||||
db: Session,
|
||||
*,
|
||||
task_id: int,
|
||||
current: User,
|
||||
) -> dict[str, Any]:
|
||||
"""普通人工代确认:客户已扫码但没点确认,运营代为提交正常 actBind。
|
||||
|
||||
不填写角色/备注,不直接标 bound;复用客户确认的同一套确认任务。
|
||||
当前没有可确认的扫码角色时,要求客户扫码或走“强制确认”。
|
||||
"""
|
||||
task = _load_task_for_update(db, task_id)
|
||||
if _frozen(task):
|
||||
return get_task_detail(db, task.id)
|
||||
refresh_binding(db, task_id=task.id)
|
||||
task = _load_task(db, task.id)
|
||||
if task.binding_status == "bound":
|
||||
return get_task_detail(db, task.id)
|
||||
if task.binding_status != "role_ready":
|
||||
raise HTTPException(
|
||||
status_code=409,
|
||||
detail=(
|
||||
"当前没有可代确认的扫码角色。请让客户先扫码;"
|
||||
"只有账号已绑定到该角色、但缺少本次扫码证据时,才使用强制确认。"
|
||||
),
|
||||
)
|
||||
return confirm_binding_sync(db, task_id=task.id, current=current)
|
||||
|
||||
|
||||
def manual_confirm_binding_sync(
|
||||
db: Session,
|
||||
*,
|
||||
|
||||
@@ -30,6 +30,7 @@ from .binding import ( # noqa: F401
|
||||
confirm_binding,
|
||||
confirm_binding_sync,
|
||||
manual_confirm_binding_sync,
|
||||
operator_confirm_binding_sync,
|
||||
reconcile_binding_observations,
|
||||
reconcile_binding_state_outbox,
|
||||
refresh_binding,
|
||||
@@ -156,6 +157,7 @@ __all__ = [
|
||||
"manual_confirm_binding_sync",
|
||||
"mapping_impact",
|
||||
"mark_manual_required",
|
||||
"operator_confirm_binding_sync",
|
||||
"prepare_manual_allocation",
|
||||
"prepare_platform_task_for_collab_takeover",
|
||||
"reconcile_binding_observations",
|
||||
|
||||
@@ -137,6 +137,10 @@ export const platformFulfillmentApi = {
|
||||
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
|
||||
`/platform-fulfillment/tasks/${taskId}/bind/confirm`,
|
||||
),
|
||||
operatorConfirmBinding: (taskId: number) =>
|
||||
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
|
||||
`/platform-fulfillment/tasks/${taskId}/bind/operator-confirm`,
|
||||
),
|
||||
manualConfirmBinding: (taskId: number, roleName: string, note: string) =>
|
||||
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
|
||||
`/platform-fulfillment/tasks/${taskId}/bind/manual-confirm`,
|
||||
|
||||
@@ -896,6 +896,18 @@ export default function PlatformFulfillmentPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const submitOperatorConfirm = async (task: PlatformFulfillmentTask) => {
|
||||
try {
|
||||
const result = await platformFulfillmentApi.operatorConfirmBinding(task.id);
|
||||
setDetail(result);
|
||||
setSelectedId(result.task.id);
|
||||
await loadTasks();
|
||||
message.success('已代客户提交确认,等待绑定结果');
|
||||
} catch (error) {
|
||||
message.error(getErrorMessage(error));
|
||||
}
|
||||
};
|
||||
|
||||
const runDouyuAccountAction = async (taskType: string) => {
|
||||
if (!selected?.account) {
|
||||
message.warning('当前履约任务还没有分配斗鱼账号');
|
||||
@@ -1432,12 +1444,17 @@ export default function PlatformFulfillmentPage() {
|
||||
) : null}
|
||||
{task.executionStatus === 'role_ready' ? (
|
||||
<Button size="small" type="primary" icon={<CheckCircleOutlined />} onClick={() => void runTaskAction(() => platformFulfillmentApi.confirmBinding(task.id))}>
|
||||
确认绑定
|
||||
代客户确认
|
||||
</Button>
|
||||
) : null}
|
||||
{canManualConfirmBinding(task) && task.executionStatus !== 'role_ready' && task.bindTask?.roleName ? (
|
||||
<Button size="small" type="primary" icon={<CheckCircleOutlined />} onClick={() => void submitOperatorConfirm(task)}>
|
||||
代客户确认
|
||||
</Button>
|
||||
) : null}
|
||||
{can('platform_fulfillment:use') && canManualConfirmBinding(task) ? (
|
||||
<Button size="small" icon={<CheckCircleOutlined />} onClick={() => openManualBinding(task)}>
|
||||
人工确认绑定
|
||||
<Button size="small" danger icon={<CheckCircleOutlined />} onClick={() => openManualBinding(task)}>
|
||||
强制确认
|
||||
</Button>
|
||||
) : null}
|
||||
{canResetBinding(task) ? (
|
||||
@@ -1485,9 +1502,17 @@ export default function PlatformFulfillmentPage() {
|
||||
刷新二维码
|
||||
</Button>
|
||||
) : null}
|
||||
{selected &&
|
||||
selected.executionStatus !== 'role_ready' &&
|
||||
selected.executionStatus !== 'bound' &&
|
||||
(selected.bindingEvidence?.scannedRole || selected.bindTask?.roleName) ? (
|
||||
<Button type="primary" icon={<CheckCircleOutlined />} onClick={() => void submitOperatorConfirm(selected)}>
|
||||
代客户确认
|
||||
</Button>
|
||||
) : null}
|
||||
{selected && can('platform_fulfillment:use') && canManualConfirmBinding(selected) ? (
|
||||
<Button icon={<CheckCircleOutlined />} onClick={() => openManualBinding(selected)}>
|
||||
人工确认绑定
|
||||
<Button danger icon={<CheckCircleOutlined />} onClick={() => openManualBinding(selected)}>
|
||||
强制确认
|
||||
</Button>
|
||||
) : null}
|
||||
{selected.account &&
|
||||
@@ -2251,9 +2276,9 @@ export default function PlatformFulfillmentPage() {
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={`人工确认绑定 ${manualBindTarget ? `#${manualBindTarget.id}` : ''}`}
|
||||
title={`人工强制确认 ${manualBindTarget ? `#${manualBindTarget.id}` : ''}`}
|
||||
open={Boolean(manualBindTarget)}
|
||||
okText="确认绑定"
|
||||
okText="强制绑定"
|
||||
cancelText="取消"
|
||||
confirmLoading={manualBinding}
|
||||
okButtonProps={{
|
||||
@@ -2270,8 +2295,8 @@ export default function PlatformFulfillmentPage() {
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
message="人工确认会直接把订单标记为已绑定"
|
||||
description="只在已核实客户游戏角色确实绑定在当前账号上时使用;会停止当前二维码轮询,并记录操作人、角色和备注。"
|
||||
message="强制确认会跳过 actBind 直接把订单标记为已绑定"
|
||||
description="只在账号当前角色已经确认绑定到该角色、但缺少本次扫码证据时使用;必须填写依据。普通代确认请用“代客户确认”。"
|
||||
/>
|
||||
{manualBindMismatch ? (
|
||||
<Alert
|
||||
|
||||
Reference in New Issue
Block a user