feat(履约绑定): 支持工作台修改客户资料、扫码不匹配时间线及确认后斗鱼复核
This commit is contained in:
@@ -13,6 +13,7 @@ from ..models import User
|
||||
from ..schemas import (
|
||||
PlatformFulfillmentCollabSyncRequest,
|
||||
PlatformFulfillmentCompleteRequest,
|
||||
PlatformFulfillmentCustomerProfileUpdate,
|
||||
PlatformFulfillmentManualBindingRequest,
|
||||
PlatformFulfillmentMappingUpsert,
|
||||
PlatformFulfillmentMappingWrite,
|
||||
@@ -524,6 +525,58 @@ def manual_confirm_binding(
|
||||
return result
|
||||
|
||||
|
||||
@router.patch("/tasks/{task_id}/customer-profile")
|
||||
def update_customer_profile(
|
||||
task_id: int,
|
||||
req: PlatformFulfillmentCustomerProfileUpdate,
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("platform_fulfillment:use")),
|
||||
) -> dict[str, Any]:
|
||||
"""运营在履约工作台修改客户填写的游戏角色、登录方式与系统。"""
|
||||
result = service.update_customer_profile_by_operator(
|
||||
db,
|
||||
task_id=task_id,
|
||||
current=current,
|
||||
customer_role_name=req.customer_role_name,
|
||||
platform=req.customer_platform,
|
||||
system=req.customer_system,
|
||||
reopen_binding=req.reopen_binding,
|
||||
)
|
||||
record_audit(
|
||||
db,
|
||||
current,
|
||||
action="platform_fulfillment:customer_profile:update",
|
||||
target=f"platform_fulfillment_task:{task_id}",
|
||||
detail={
|
||||
"customerRoleName": req.customer_role_name,
|
||||
"customerPlatform": req.customer_platform,
|
||||
"customerSystem": req.customer_system,
|
||||
"reopenBinding": req.reopen_binding,
|
||||
},
|
||||
)
|
||||
db.commit()
|
||||
return result
|
||||
|
||||
|
||||
@router.post("/tasks/{task_id}/bind/verify")
|
||||
async def verify_binding(
|
||||
task_id: int,
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("platform_fulfillment:use")),
|
||||
) -> dict[str, Any]:
|
||||
"""去斗鱼再次实时查询并复核当前绑定是否真正生效。"""
|
||||
result = await service.verify_task_binding(db, task_id=task_id, current=current)
|
||||
record_audit(
|
||||
db,
|
||||
current,
|
||||
action="platform_fulfillment:binding:verify",
|
||||
target=f"platform_fulfillment_task:{task_id}",
|
||||
detail={"bindingStatus": result.get("task", {}).get("bindingStatus")},
|
||||
)
|
||||
db.commit()
|
||||
return result
|
||||
|
||||
|
||||
@router.post("/tasks/{task_id}/eligibility/refresh")
|
||||
def refresh_eligibility(
|
||||
task_id: int,
|
||||
|
||||
@@ -1734,6 +1734,13 @@ class PlatformFulfillmentManualBindingRequest(BaseModel):
|
||||
note: str = Field(default="", max_length=500)
|
||||
|
||||
|
||||
class PlatformFulfillmentCustomerProfileUpdate(BaseModel):
|
||||
customer_role_name: str = Field(..., min_length=1, max_length=128)
|
||||
customer_platform: str = Field(..., pattern="^(wechat|qq)$")
|
||||
customer_system: str = Field(..., pattern="^(ios|android)$")
|
||||
reopen_binding: bool = True
|
||||
|
||||
|
||||
class PlatformFulfillmentSettingsUpdate(BaseModel):
|
||||
lease_duration_minutes: int | None = Field(..., ge=1, le=525600)
|
||||
completed_release_delay_minutes: int | None = Field(
|
||||
|
||||
@@ -1078,6 +1078,24 @@ class BindMixin:
|
||||
|
||||
def finish_timeout() -> None:
|
||||
self._merge_latest_expected_role(db, task, result)
|
||||
latest_expected = str(result.get("expected_role_name") or "").strip()
|
||||
last_mismatch = result.get("last_mismatched_role")
|
||||
mismatched_role = (
|
||||
str(last_mismatch.get("role_name") or "").strip()
|
||||
if isinstance(last_mismatch, dict)
|
||||
else ""
|
||||
)
|
||||
if mismatched_role and latest_expected:
|
||||
timeout_message = (
|
||||
f"绑定二维码已过期:期间扫到「{mismatched_role}」,"
|
||||
f"与填写角色「{latest_expected}」不一致"
|
||||
)
|
||||
elif mismatched_role:
|
||||
timeout_message = (
|
||||
f"绑定二维码已过期:期间扫到「{mismatched_role}」,未匹配到目标角色"
|
||||
)
|
||||
else:
|
||||
timeout_message = "绑定二维码已过期,未识别到新扫码角色"
|
||||
result.update(
|
||||
{
|
||||
"bind_polling": False,
|
||||
@@ -1094,7 +1112,7 @@ class BindMixin:
|
||||
db,
|
||||
task,
|
||||
"failed",
|
||||
"绑定二维码已过期,未识别到新扫码角色",
|
||||
timeout_message[:512],
|
||||
result,
|
||||
)
|
||||
|
||||
@@ -1370,6 +1388,57 @@ class BindMixin:
|
||||
result["current_role_name"] = snapshot["role_name"]
|
||||
result["current_area_name"] = snapshot["area_name"]
|
||||
result["current_plat_name"] = snapshot["plat_name"]
|
||||
|
||||
new_mismatch_observed = False
|
||||
if expected_role_name:
|
||||
candidate_by_alias = {
|
||||
str(item.get("act_alias") or item.get("alias") or "").strip(): item
|
||||
for item in candidates
|
||||
if isinstance(item, dict)
|
||||
}
|
||||
recorded_keys = [
|
||||
str(v)
|
||||
for v in (result.get("recorded_mismatched_roles") or [])
|
||||
if str(v or "").strip()
|
||||
]
|
||||
mismatched_roles = [
|
||||
dict(item)
|
||||
for item in (result.get("mismatched_roles") or [])
|
||||
if isinstance(item, dict)
|
||||
]
|
||||
for decision in candidate_decisions:
|
||||
if str(decision.get("reason") or "") != "expected_role_mismatch":
|
||||
continue
|
||||
if bool(decision.get("is_bound_act")):
|
||||
continue
|
||||
scanned_name = str(decision.get("role_name") or "").strip()
|
||||
if not scanned_name:
|
||||
continue
|
||||
alias = str(decision.get("alias") or "").strip()
|
||||
cand = candidate_by_alias.get(alias) or {}
|
||||
cand_snap = self._bind_snapshot(cand) if cand else {}
|
||||
area_name = str(cand_snap.get("area_name") or cand.get("area_name") or "").strip()
|
||||
plat_name = str(cand_snap.get("plat_name") or cand.get("plat_name") or "").strip()
|
||||
dedupe_key = f"{alias}|{scanned_name.casefold()}|{area_name}|{plat_name}"
|
||||
if dedupe_key in recorded_keys:
|
||||
continue
|
||||
recorded_keys.append(dedupe_key)
|
||||
entry = {
|
||||
"act_alias": alias,
|
||||
"role_name": scanned_name,
|
||||
"area_name": area_name,
|
||||
"plat_name": plat_name,
|
||||
"expected_role_name": expected_role_name,
|
||||
"observed_at": now.isoformat(),
|
||||
}
|
||||
mismatched_roles.append(entry)
|
||||
result["last_mismatched_role"] = entry
|
||||
new_mismatch_observed = True
|
||||
if recorded_keys:
|
||||
result["recorded_mismatched_roles"] = recorded_keys[-20:]
|
||||
if mismatched_roles:
|
||||
result["mismatched_roles"] = mismatched_roles[-10:]
|
||||
|
||||
result.update(
|
||||
{
|
||||
"bind_info": bind_info,
|
||||
@@ -1413,7 +1482,7 @@ class BindMixin:
|
||||
"running",
|
||||
f"等待扫码绑定 ({summary})",
|
||||
result,
|
||||
sync_platform=False,
|
||||
sync_platform=bool(task.platform_task_id and new_mismatch_observed),
|
||||
)
|
||||
|
||||
def _execute_get_bind_qr(
|
||||
|
||||
@@ -265,6 +265,37 @@ class DouyuBatchRunnerCore:
|
||||
"[douyu] 同步直播账号履约状态失败: task_id={}", douyu_task_id
|
||||
)
|
||||
|
||||
def _verify_platform_binding(
|
||||
self,
|
||||
douyu_task_id: int,
|
||||
*,
|
||||
enabled: bool,
|
||||
) -> None:
|
||||
"""确认绑定完成后,再去斗鱼实时查询复核一次。"""
|
||||
if not enabled:
|
||||
return
|
||||
try:
|
||||
from ..database import WorkerSessionLocal
|
||||
from .platform_fulfillment.service import verify_active_binding_for_douyu_task
|
||||
|
||||
verify_db = WorkerSessionLocal()
|
||||
try:
|
||||
task = verify_db.get(DouyuTask, int(douyu_task_id))
|
||||
if task is None or task.status != "success":
|
||||
return
|
||||
verify_active_binding_for_douyu_task(
|
||||
verify_db,
|
||||
douyu_task_id=int(douyu_task_id),
|
||||
actor_id=int(task.created_by),
|
||||
)
|
||||
finally:
|
||||
verify_db.close()
|
||||
except Exception: # noqa: BLE001 - 复核异常不能覆盖主任务提交
|
||||
logger.exception(
|
||||
"[douyu] 自动复核直播履约绑定状态失败: task_id={}",
|
||||
douyu_task_id,
|
||||
)
|
||||
|
||||
def _refresh_platform_exchange_eligibility(
|
||||
self,
|
||||
douyu_task_id: int,
|
||||
@@ -405,6 +436,10 @@ class DouyuBatchRunnerCore:
|
||||
task_id,
|
||||
enabled=sync_platform_fulfillment,
|
||||
)
|
||||
self._verify_platform_binding(
|
||||
task_id,
|
||||
enabled=(status == "success" and task.task_type == "confirm_bind"),
|
||||
)
|
||||
self._refresh_platform_exchange_eligibility(
|
||||
task_id,
|
||||
enabled=(
|
||||
|
||||
@@ -45,7 +45,7 @@ from .binding_status import (
|
||||
_binding_failure_raw_message,
|
||||
_customer_task_message,
|
||||
)
|
||||
from .common import FLOW_VERSION_CLEAN, _has_game_home_profile, _now
|
||||
from .common import FLOW_VERSION_CLEAN, SCOPE_ELITE, _has_game_home_profile, _now
|
||||
from .outbox import _emit_order_site_binding_state
|
||||
from .repository import (
|
||||
_binding_qr_expired,
|
||||
@@ -65,6 +65,18 @@ from .runtime import (
|
||||
_apply_task_lease_policy,
|
||||
)
|
||||
from .views import get_task_detail
|
||||
from ..douyu_account_probe import (
|
||||
ROLE_BOUND,
|
||||
ROLE_ERROR,
|
||||
ROLE_UNKNOWN,
|
||||
activity_client,
|
||||
config_mapping,
|
||||
elite_action_aliases,
|
||||
persist_probe_result,
|
||||
resolve_elite_role,
|
||||
)
|
||||
from ..douyu_role_audit import record_role_api_candidates
|
||||
from ..douyu_service import ensure_douyu_config
|
||||
|
||||
BINDING_SYNC_TASK_TYPES = frozenset(
|
||||
{
|
||||
@@ -488,6 +500,85 @@ def _latest_observations_for_task(
|
||||
)
|
||||
|
||||
|
||||
def _record_mismatched_scan_events(
|
||||
db: Session,
|
||||
task: PlatformFulfillmentTask,
|
||||
source: DouyuTask,
|
||||
) -> bool:
|
||||
"""把扫码出现的不匹配角色写入时间线(按任务+角色+区服去重)。"""
|
||||
result = source.result if isinstance(source.result, dict) else {}
|
||||
entries = [
|
||||
item
|
||||
for item in (result.get("mismatched_roles") or [])
|
||||
if isinstance(item, dict) and str(item.get("role_name") or "").strip()
|
||||
]
|
||||
last_entry = result.get("last_mismatched_role")
|
||||
if (
|
||||
not entries
|
||||
and isinstance(last_entry, dict)
|
||||
and str(last_entry.get("role_name") or "").strip()
|
||||
):
|
||||
entries = [last_entry]
|
||||
if not entries:
|
||||
return False
|
||||
|
||||
existing_events = (
|
||||
db.query(PlatformFulfillmentEvent.detail_json)
|
||||
.filter(
|
||||
PlatformFulfillmentEvent.task_id == int(task.id),
|
||||
PlatformFulfillmentEvent.event_type == "binding_scanned_role_mismatch",
|
||||
)
|
||||
.order_by(PlatformFulfillmentEvent.id.desc())
|
||||
.limit(50)
|
||||
.all()
|
||||
)
|
||||
seen: set[tuple[int, str, str]] = set()
|
||||
for row in existing_events:
|
||||
detail = row[0] if isinstance(row[0], dict) else {}
|
||||
try:
|
||||
src_id = int(detail.get("sourceTaskId") or 0)
|
||||
except (TypeError, ValueError):
|
||||
src_id = 0
|
||||
seen.add(
|
||||
(
|
||||
src_id,
|
||||
str(detail.get("scannedRoleName") or "").strip().casefold(),
|
||||
str(detail.get("channel") or "").strip(),
|
||||
)
|
||||
)
|
||||
|
||||
appended = False
|
||||
for entry in entries:
|
||||
scanned_role = str(entry.get("role_name") or "").strip()
|
||||
if not scanned_role:
|
||||
continue
|
||||
area_name = str(entry.get("area_name") or "").strip()
|
||||
plat_name = str(entry.get("plat_name") or "").strip()
|
||||
channel = " / ".join(part for part in (area_name, plat_name) if part)
|
||||
key = (int(source.id), scanned_role.casefold(), channel)
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
expected_role = str(
|
||||
entry.get("expected_role_name") or task.customer_role_name or ""
|
||||
).strip()
|
||||
_append_event(
|
||||
db,
|
||||
task.id,
|
||||
"binding_scanned_role_mismatch",
|
||||
detail={
|
||||
"sourceTaskId": int(source.id),
|
||||
"sourceTaskType": str(source.task_type or ""),
|
||||
"scannedRoleName": scanned_role[:128],
|
||||
"expectedRoleName": expected_role[:128],
|
||||
"channel": channel[:128],
|
||||
"actAlias": str(entry.get("act_alias") or "")[:64],
|
||||
},
|
||||
)
|
||||
appended = True
|
||||
return appended
|
||||
|
||||
|
||||
def _record_binding_rejection(
|
||||
db: Session,
|
||||
task: PlatformFulfillmentTask,
|
||||
@@ -1012,24 +1103,43 @@ def _apply_binding_task(
|
||||
)
|
||||
result = source.result if isinstance(source.result, dict) else {}
|
||||
previous_bind_task_id = task.bind_task_id
|
||||
mismatch_recorded = _record_mismatched_scan_events(db, task, source)
|
||||
|
||||
if source.status in {"failed", "error", "stopped"}:
|
||||
# 只有订单当前挂着的任务失败才允许判失败;工作台额外任务失败不能打死订单。
|
||||
if not is_current:
|
||||
return False
|
||||
return mismatch_recorded
|
||||
if phase not in ACTIVE_BINDING_STATUSES | {"confirming", "failed"}:
|
||||
return False
|
||||
return mismatch_recorded
|
||||
issue_code = _binding_failure_issue(source, result)
|
||||
if (
|
||||
task.binding_status == "failed"
|
||||
and task.issue_code == issue_code
|
||||
and int(task.bind_task_id or 0) == int(source.id)
|
||||
):
|
||||
return False
|
||||
return mismatch_recorded
|
||||
task.binding_status = "failed"
|
||||
task.execution_status = "manual_required"
|
||||
task.issue_code = issue_code
|
||||
task.last_error = _customer_task_message(task)
|
||||
last_mismatch = result.get("last_mismatched_role")
|
||||
mismatched_name = (
|
||||
str(last_mismatch.get("role_name") or "").strip()
|
||||
if isinstance(last_mismatch, dict)
|
||||
else ""
|
||||
)
|
||||
expected_name = str(
|
||||
(last_mismatch.get("expected_role_name") if isinstance(last_mismatch, dict) else "")
|
||||
or task.customer_role_name
|
||||
or ""
|
||||
).strip()
|
||||
if issue_code == "binding_failed" and mismatched_name:
|
||||
task.last_error = (
|
||||
f"已扫到角色「{mismatched_name}」,与下单填写的「{expected_name}」不一致,请核对后修改资料或重扫"
|
||||
if expected_name
|
||||
else f"已扫到不匹配角色「{mismatched_name}」,请核对后重扫"
|
||||
)
|
||||
else:
|
||||
task.last_error = _customer_task_message(task)
|
||||
task.updated_at = _now()
|
||||
_append_event(
|
||||
db,
|
||||
@@ -1052,14 +1162,17 @@ def _apply_binding_task(
|
||||
|
||||
if source.status != "success":
|
||||
# 运行中的绑码任务可以展示二维码,但不能据此推进角色/结算。
|
||||
return _apply_binding_qr_display(
|
||||
db,
|
||||
task,
|
||||
source,
|
||||
owned=owned,
|
||||
is_current=is_current,
|
||||
phase=phase,
|
||||
lease=lease,
|
||||
return (
|
||||
_apply_binding_qr_display(
|
||||
db,
|
||||
task,
|
||||
source,
|
||||
owned=owned,
|
||||
is_current=is_current,
|
||||
phase=phase,
|
||||
lease=lease,
|
||||
)
|
||||
or mismatch_recorded
|
||||
)
|
||||
|
||||
if binding.status == BINDING_VIEW_CONFIRMED:
|
||||
@@ -1957,3 +2070,253 @@ async def confirm_binding(
|
||||
task_id=task_id,
|
||||
current=current,
|
||||
)
|
||||
|
||||
|
||||
def verify_task_binding_sync(
|
||||
db: Session,
|
||||
*,
|
||||
task_id: int,
|
||||
current: User | None = None,
|
||||
automatic: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""确认绑定后,向斗鱼实时复核当前账号绑定状态与角色是否一致。"""
|
||||
task = _load_task(db, task_id)
|
||||
if task.execution_status in {"completed", "cancelled"}:
|
||||
if automatic:
|
||||
return get_task_detail(db, task.id)
|
||||
raise HTTPException(status_code=409, detail="已结束任务无需复核绑定")
|
||||
if task.binding_status != "bound":
|
||||
if automatic:
|
||||
return get_task_detail(db, task.id)
|
||||
raise HTTPException(status_code=409, detail="当前订单尚未绑定确认,无法复核")
|
||||
if not task.account_id:
|
||||
if automatic:
|
||||
return get_task_detail(db, task.id)
|
||||
raise HTTPException(status_code=409, detail="当前任务尚未分配账号")
|
||||
|
||||
account = db.get(Account, int(task.account_id))
|
||||
if account is None or not str(account.cookie or "").strip():
|
||||
if automatic:
|
||||
_append_event(
|
||||
db,
|
||||
task.id,
|
||||
"binding_verify_error",
|
||||
actor_type="system",
|
||||
detail={"error": "账号 Cookie 不可用,跳过自动复核", "automatic": True},
|
||||
)
|
||||
db.commit()
|
||||
return get_task_detail(db, task.id)
|
||||
raise HTTPException(status_code=409, detail="账号 Cookie 不可用,无法查询斗鱼")
|
||||
|
||||
config = config_mapping(ensure_douyu_config(db))
|
||||
cookie = str(account.cookie or "").strip()
|
||||
bind_task_id = int(task.bind_task_id) if task.bind_task_id else None
|
||||
account_id = int(account.id)
|
||||
client = activity_client(cookie)
|
||||
try:
|
||||
role = resolve_elite_role(client, config)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
role = {"status": ROLE_ERROR, "errors": [str(exc)], "bind_infos": []}
|
||||
|
||||
bind_infos = [
|
||||
item for item in (role.get("bind_infos") or []) if isinstance(item, dict)
|
||||
]
|
||||
if bind_infos:
|
||||
record_role_api_candidates(
|
||||
db,
|
||||
account_id=account_id,
|
||||
task_id=bind_task_id,
|
||||
candidates=bind_infos,
|
||||
scope=SCOPE_ELITE,
|
||||
stage="fulfillment.verify_binding",
|
||||
source="platform.verify_binding",
|
||||
)
|
||||
|
||||
task = _load_task_for_update(db, task_id)
|
||||
account = db.get(Account, int(task.account_id)) if task.account_id else None
|
||||
if (
|
||||
account is None
|
||||
or task.execution_status in {"completed", "cancelled"}
|
||||
or task.binding_status != "bound"
|
||||
):
|
||||
if bind_infos:
|
||||
db.commit()
|
||||
return get_task_detail(db, task.id)
|
||||
|
||||
role_status = str(role.get("status") or "")
|
||||
actor_type = "system" if automatic or current is None else "user"
|
||||
actor_id = None if automatic or current is None else int(current.id)
|
||||
if role_status in {ROLE_ERROR, ROLE_UNKNOWN}:
|
||||
err_text = ";".join(str(x) for x in (role.get("errors") or []) if x) or "斗鱼接口查询异常"
|
||||
_append_event(
|
||||
db,
|
||||
task.id,
|
||||
"binding_verify_error",
|
||||
actor_type=actor_type,
|
||||
actor_id=actor_id,
|
||||
detail={"error": err_text[:500], "automatic": automatic},
|
||||
)
|
||||
db.commit()
|
||||
return get_task_detail(db, task.id)
|
||||
|
||||
persist_probe_result(
|
||||
db,
|
||||
account,
|
||||
{
|
||||
"probe_id": f"pf-verify:{task.id}",
|
||||
"identity": {"uid": account.uid, "username": account.username},
|
||||
"session": {},
|
||||
"elite": {},
|
||||
"eligibility": {},
|
||||
"roles": {"elite": role},
|
||||
"gold": {},
|
||||
"goods": {},
|
||||
"errors": {},
|
||||
},
|
||||
current=current,
|
||||
source="platform.verify_binding",
|
||||
record_event=False,
|
||||
)
|
||||
|
||||
action_aliases = set(elite_action_aliases(config))
|
||||
action_bound = next(
|
||||
(
|
||||
item
|
||||
for item in bind_infos
|
||||
if str(item.get("act_alias") or "").strip() in action_aliases
|
||||
and bool(item.get("is_bound_act"))
|
||||
and str(item.get("role_name") or "").strip()
|
||||
),
|
||||
None,
|
||||
)
|
||||
actual_role = (
|
||||
str((action_bound or role).get("role_name") or "").strip()
|
||||
if role_status == ROLE_BOUND
|
||||
else ""
|
||||
)
|
||||
actual_alias = str(
|
||||
(action_bound or {}).get("act_alias")
|
||||
or role.get("source_alias")
|
||||
or ""
|
||||
).strip()
|
||||
actual_channel = str(role.get("game_channel") or "").strip()
|
||||
expected_role = str(
|
||||
task.customer_role_name or _order_target_role(db, task) or ""
|
||||
).strip()
|
||||
|
||||
verified = bool(
|
||||
role_status == ROLE_BOUND
|
||||
and actual_role
|
||||
and (not expected_role or role_names_match(actual_role, expected_role))
|
||||
)
|
||||
if verified:
|
||||
_append_event(
|
||||
db,
|
||||
task.id,
|
||||
"binding_verified",
|
||||
actor_type=actor_type,
|
||||
actor_id=actor_id,
|
||||
detail={
|
||||
"roleName": actual_role[:128],
|
||||
"expectedRoleName": expected_role[:128],
|
||||
"channel": actual_channel[:128],
|
||||
"actAlias": actual_alias[:64],
|
||||
"automatic": automatic,
|
||||
},
|
||||
)
|
||||
db.commit()
|
||||
return get_task_detail(db, task.id)
|
||||
|
||||
lease = _lease_for_task(db, task)
|
||||
if actual_role and expected_role:
|
||||
mismatch_msg = (
|
||||
f"斗鱼复核未通过:当前绑定角色为「{actual_role}」,"
|
||||
f"与订单目标「{expected_role}」不一致"
|
||||
)
|
||||
issue_code = "role_changed"
|
||||
else:
|
||||
pending_role = str(role.get("pending_role_name") or role.get("role_name") or "").strip()
|
||||
mismatch_msg = (
|
||||
f"斗鱼复核未通过:角色「{pending_role}」仍处于待确认,尚未绑定生效"
|
||||
if pending_role
|
||||
else "斗鱼复核未通过:斗鱼接口当前显示未绑定生效"
|
||||
)
|
||||
issue_code = "binding_failed"
|
||||
task.binding_status = "failed"
|
||||
task.execution_status = "manual_required"
|
||||
task.issue_code = issue_code
|
||||
task.last_error = mismatch_msg
|
||||
task.updated_at = _now()
|
||||
_append_event(
|
||||
db,
|
||||
task.id,
|
||||
"binding_verify_failed",
|
||||
actor_type=actor_type,
|
||||
actor_id=actor_id,
|
||||
detail={
|
||||
"expectedRoleName": expected_role[:128],
|
||||
"actualRoleName": actual_role[:128],
|
||||
"actualStatus": role_status,
|
||||
"channel": actual_channel[:128],
|
||||
"actAlias": actual_alias[:64],
|
||||
"message": mismatch_msg,
|
||||
"automatic": automatic,
|
||||
},
|
||||
)
|
||||
_apply_task_lease_policy(db, task, lease=lease)
|
||||
_emit_order_site_binding_state(db, task.id)
|
||||
db.commit()
|
||||
return get_task_detail(db, task.id)
|
||||
|
||||
|
||||
async def verify_task_binding(
|
||||
db: Session, *, task_id: int, current: User
|
||||
) -> dict[str, Any]:
|
||||
return await run_in_threadpool(
|
||||
verify_task_binding_sync,
|
||||
db,
|
||||
task_id=task_id,
|
||||
current=current,
|
||||
automatic=False,
|
||||
)
|
||||
|
||||
|
||||
def verify_active_binding_for_douyu_task(
|
||||
db: Session,
|
||||
*,
|
||||
douyu_task_id: int,
|
||||
actor_id: int | None = None,
|
||||
) -> dict[str, Any] | None:
|
||||
"""confirm_bind 完成后,自动向斗鱼再复核一次对应履约订单的绑定结果。"""
|
||||
douyu_task = db.get(DouyuTask, int(douyu_task_id))
|
||||
if (
|
||||
douyu_task is None
|
||||
or douyu_task.status != "success"
|
||||
or str(douyu_task.task_type or "") != "confirm_bind"
|
||||
or str(douyu_task.handbook_scope or "") != "elite"
|
||||
):
|
||||
return None
|
||||
query = db.query(PlatformFulfillmentTask).filter(
|
||||
PlatformFulfillmentTask.scope == "elite",
|
||||
PlatformFulfillmentTask.binding_status == "bound",
|
||||
PlatformFulfillmentTask.execution_status.notin_(("completed", "cancelled")),
|
||||
)
|
||||
if douyu_task.platform_task_id:
|
||||
task = query.filter(
|
||||
PlatformFulfillmentTask.id == int(douyu_task.platform_task_id)
|
||||
).first()
|
||||
else:
|
||||
task = (
|
||||
query.filter(PlatformFulfillmentTask.bind_task_id == int(douyu_task.id))
|
||||
.order_by(PlatformFulfillmentTask.id.desc())
|
||||
.first()
|
||||
)
|
||||
if task is None:
|
||||
return None
|
||||
actor = db.get(User, int(actor_id)) if actor_id is not None else None
|
||||
return verify_task_binding_sync(
|
||||
db,
|
||||
task_id=int(task.id),
|
||||
current=actor,
|
||||
automatic=True,
|
||||
)
|
||||
|
||||
@@ -315,6 +315,23 @@ def build_binding_evidence(
|
||||
scanned_role,
|
||||
now=now,
|
||||
)
|
||||
raw_mismatch = result.get("last_mismatched_role")
|
||||
mismatched_role = None
|
||||
if isinstance(raw_mismatch, dict) and _text(raw_mismatch.get("role_name")):
|
||||
mismatched_role = {
|
||||
"alias": _text(raw_mismatch.get("act_alias")),
|
||||
"roleName": _text(raw_mismatch.get("role_name")),
|
||||
"areaName": _text(raw_mismatch.get("area_name")),
|
||||
"platName": _text(raw_mismatch.get("plat_name")),
|
||||
"channel": _channel(
|
||||
_text(raw_mismatch.get("area_name")),
|
||||
_text(raw_mismatch.get("plat_name")),
|
||||
),
|
||||
"expectedRoleName": _text(
|
||||
raw_mismatch.get("expected_role_name") or task.customer_role_name
|
||||
),
|
||||
"observedAt": _text(raw_mismatch.get("observed_at")),
|
||||
}
|
||||
return {
|
||||
"sourceTaskId": int(bind_task.id),
|
||||
"sourceTaskType": str(bind_task.task_type or ""),
|
||||
@@ -328,6 +345,7 @@ def build_binding_evidence(
|
||||
"confirmable": confirmable,
|
||||
"targetRole": target_role,
|
||||
"scannedRole": scanned_role,
|
||||
"mismatchedRole": mismatched_role,
|
||||
"baselineRole": baseline_role,
|
||||
"samePair": same_pair,
|
||||
"actionCurrent": action_current,
|
||||
|
||||
@@ -92,6 +92,23 @@ def _binding_failure_raw_message(
|
||||
f"待绑定游戏账号({role_name or '-'})未到换绑时间"
|
||||
"(不是斗鱼/虎牙账号),请重新换账号扫码绑定"
|
||||
)
|
||||
if issue_code == "binding_failed":
|
||||
last_mismatch = result.get("last_mismatched_role")
|
||||
mismatched_name = (
|
||||
str(last_mismatch.get("role_name") or "").strip()
|
||||
if isinstance(last_mismatch, dict)
|
||||
else ""
|
||||
)
|
||||
expected = str(
|
||||
(last_mismatch.get("expected_role_name") if isinstance(last_mismatch, dict) else "")
|
||||
or result.get("expected_role_name")
|
||||
or ""
|
||||
).strip()
|
||||
if mismatched_name and expected:
|
||||
return (
|
||||
f"绑定二维码已过期:期间扫到「{mismatched_name}」,"
|
||||
f"与填写角色「{expected}」不一致"
|
||||
)
|
||||
return fallback
|
||||
|
||||
|
||||
|
||||
@@ -13,21 +13,23 @@ from ...models import (
|
||||
PlatformFulfillmentTask,
|
||||
)
|
||||
from .binding import (
|
||||
ACTIVE_BINDING_STATUSES,
|
||||
confirm_binding,
|
||||
refresh_binding,
|
||||
start_binding,
|
||||
sync_customer_role_to_bind_task,
|
||||
)
|
||||
from .common import FLOW_VERSION_CLEAN, _has_game_home_profile
|
||||
from .common import FLOW_VERSION_CLEAN, _has_game_home_profile, _now
|
||||
from .order_sync import sync_order_item_ids
|
||||
from .outbox import _emit_order_site_binding_state
|
||||
from .repository import (
|
||||
_find_customer_task,
|
||||
_integration_actor,
|
||||
_load_task,
|
||||
_load_task_for_update,
|
||||
)
|
||||
from .runtime import _append_event
|
||||
from .views import customer_binding_out
|
||||
from .runtime import _append_event, _apply_task_lease_policy
|
||||
from .views import customer_binding_out, get_task_detail
|
||||
|
||||
|
||||
def ensure_customer_session(
|
||||
@@ -199,3 +201,101 @@ async def customer_confirm_binding(db: Session, *, task_id: int) -> dict[str, An
|
||||
refresh_binding(db, task_id=task_id)
|
||||
await confirm_binding(db, task_id=task_id, current=_integration_actor(db))
|
||||
return customer_binding_out(db, task_id)
|
||||
|
||||
|
||||
def update_customer_profile_by_operator(
|
||||
db: Session,
|
||||
*,
|
||||
task_id: int,
|
||||
current: Any,
|
||||
customer_role_name: str,
|
||||
platform: str,
|
||||
system: str,
|
||||
reopen_binding: bool = True,
|
||||
) -> dict[str, Any]:
|
||||
"""工作台运营人工修改客户填写的角色、登录方式和系统。"""
|
||||
task = _load_task_for_update(db, task_id)
|
||||
if task.execution_status in {"completed", "cancelled"}:
|
||||
raise HTTPException(status_code=409, detail="订单已结束,不能修改客户资料")
|
||||
if task.binding_status == "bound":
|
||||
raise HTTPException(status_code=409, detail="角色已绑定确认,不能直接修改客户资料")
|
||||
if task.binding_status == "confirming":
|
||||
raise HTTPException(status_code=409, detail="正在确认绑定中,请稍后再试")
|
||||
|
||||
new_role = str(customer_role_name or "").strip()[:128]
|
||||
new_platform = str(platform or "").strip()[:16]
|
||||
new_system = str(system or "").strip()[:16]
|
||||
if not new_role:
|
||||
raise HTTPException(status_code=422, detail="请填写客户游戏角色名")
|
||||
if new_platform not in {"wechat", "qq"}:
|
||||
raise HTTPException(status_code=422, detail="登录方式只能选择微信或 QQ")
|
||||
if new_system not in {"ios", "android"}:
|
||||
raise HTTPException(status_code=422, detail="系统只能选择苹果或安卓")
|
||||
|
||||
old_role = str(task.customer_role_name or "").strip()
|
||||
old_platform = str(task.customer_platform or "").strip()
|
||||
old_system = str(task.customer_system or "").strip()
|
||||
|
||||
now = _now()
|
||||
task.customer_role_name = new_role
|
||||
task.customer_platform = new_platform
|
||||
task.customer_system = new_system
|
||||
task.customer_profile_updated_at = now
|
||||
task.operator_id = int(current.id)
|
||||
task.updated_at = now
|
||||
|
||||
reopened = False
|
||||
if (
|
||||
reopen_binding
|
||||
and task.binding_status == "failed"
|
||||
and task.issue_code
|
||||
in {
|
||||
"binding_failed",
|
||||
"role_changed",
|
||||
"customer_role_cooldown",
|
||||
"customer_role_bound_elsewhere",
|
||||
}
|
||||
):
|
||||
lease = (
|
||||
db.query(AccountLease).filter(AccountLease.id == task.lease_id).first()
|
||||
if task.lease_id
|
||||
else None
|
||||
)
|
||||
task.bind_task_id = None
|
||||
task.binding_status = "not_started"
|
||||
task.issue_code = ""
|
||||
task.last_error = ""
|
||||
if task.account_id and lease is not None and lease.status == "active":
|
||||
task.execution_status = "allocated"
|
||||
_apply_task_lease_policy(db, task, lease=lease)
|
||||
else:
|
||||
task.account_id = None
|
||||
task.lease_id = None
|
||||
task.execution_status = "ready"
|
||||
reopened = True
|
||||
elif task.bind_task_id and task.binding_status in ACTIVE_BINDING_STATUSES:
|
||||
sync_customer_role_to_bind_task(db, task)
|
||||
|
||||
_append_event(
|
||||
db,
|
||||
task.id,
|
||||
"customer_profile_updated",
|
||||
actor_type="user",
|
||||
actor_id=current.id,
|
||||
detail={
|
||||
"previousRoleName": old_role,
|
||||
"customerRoleName": new_role,
|
||||
"previousPlatform": old_platform,
|
||||
"platform": new_platform,
|
||||
"previousSystem": old_system,
|
||||
"system": new_system,
|
||||
"reopenedBinding": reopened,
|
||||
},
|
||||
)
|
||||
_emit_order_site_binding_state(db, task.id)
|
||||
db.commit()
|
||||
if reopened and task.execution_status == "ready":
|
||||
from .auto_allocator import wake_auto_allocator
|
||||
|
||||
wake_auto_allocator([int(task.id)])
|
||||
return get_task_detail(db, task.id)
|
||||
|
||||
@@ -40,6 +40,9 @@ from .binding import ( # noqa: F401
|
||||
start_binding_sync,
|
||||
sync_active_task_from_account_binding,
|
||||
sync_task_from_binding_runner,
|
||||
verify_active_binding_for_douyu_task,
|
||||
verify_task_binding,
|
||||
verify_task_binding_sync,
|
||||
)
|
||||
from .binding_status import ( # noqa: F401
|
||||
_binding_failure_issue,
|
||||
@@ -69,6 +72,7 @@ from .customer import (
|
||||
customer_start_binding,
|
||||
ensure_customer_session,
|
||||
save_customer_profile,
|
||||
update_customer_profile_by_operator,
|
||||
)
|
||||
from .lifecycle import (
|
||||
cancel_task,
|
||||
@@ -184,7 +188,11 @@ __all__ = [
|
||||
"sync_pending_tasks",
|
||||
"sync_pending_tasks_if_due",
|
||||
"sync_task_from_binding_runner",
|
||||
"update_customer_profile_by_operator",
|
||||
"update_mapping",
|
||||
"update_settings",
|
||||
"upsert_mapping",
|
||||
"verify_active_binding_for_douyu_task",
|
||||
"verify_task_binding",
|
||||
"verify_task_binding_sync",
|
||||
]
|
||||
|
||||
@@ -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`,
|
||||
|
||||
@@ -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="履约同步与租约设置"
|
||||
|
||||
Reference in New Issue
Block a user