fix(douyu): 修正绑定状态与换绑冷却判定
This commit is contained in:
@@ -31,6 +31,7 @@ from ...models import (
|
||||
from ...permissions import ROLE_LABELS
|
||||
from ..account_binding import (
|
||||
binding_role_from_result,
|
||||
is_platform_account_bind_cooldown,
|
||||
pending_binding_role_from_result,
|
||||
)
|
||||
from ..account_capability_service import (
|
||||
@@ -1410,7 +1411,7 @@ def _customer_task_message(task: PlatformFulfillmentTask) -> str:
|
||||
"points_short": "账号正在补充积分,请稍后重试",
|
||||
"commodity_limit_reached": "当前商品暂时无法兑换,请联系客服",
|
||||
"binding_failed": "暂未识别到绑定角色,请继续使用当前二维码完成扫码",
|
||||
"account_role_cooldown": "当前绑定账号暂不可换绑,请截图本页面并联系客服处理",
|
||||
"account_role_cooldown": "当前斗鱼账号未到换绑时间,请截图本页面并联系客服处理",
|
||||
"customer_role_cooldown": "该游戏角色仍在换绑冷却期,请截图本页面并联系客服处理",
|
||||
"eligibility_check_failed": "状态查询异常,请稍后刷新",
|
||||
"manual_required": "当前需要人工处理,请联系客服",
|
||||
@@ -1419,9 +1420,20 @@ def _customer_task_message(task: PlatformFulfillmentTask) -> str:
|
||||
|
||||
|
||||
def _binding_failure_issue(bind_task: DouyuTask, result: dict[str, Any]) -> str:
|
||||
explicit_issue = str(result.get("issue_code") or "")
|
||||
if explicit_issue in {"account_role_cooldown", "customer_role_cooldown"}:
|
||||
return explicit_issue
|
||||
phase = str(result.get("bind_phase") or "")
|
||||
message = str(bind_task.message or "")
|
||||
if phase == "change_waiting" or "暂不能换绑" in message:
|
||||
confirm_error = str(result.get("confirm_error") or "")
|
||||
if (
|
||||
phase == "change_waiting"
|
||||
or is_platform_account_bind_cooldown(
|
||||
result.get("confirm_error_code"),
|
||||
f"{message} {confirm_error}",
|
||||
)
|
||||
or "暂不能换绑" in message
|
||||
):
|
||||
task_issue = "account_role_cooldown"
|
||||
elif (
|
||||
phase == "confirm_failed"
|
||||
@@ -1432,7 +1444,7 @@ def _binding_failure_issue(bind_task: DouyuTask, result: dict[str, Any]) -> str:
|
||||
else:
|
||||
return "binding_failed"
|
||||
messages = {
|
||||
"account_role_cooldown": "当前绑定账号暂不可换绑,请截图本页面并联系客服处理",
|
||||
"account_role_cooldown": "当前斗鱼账号未到换绑时间,请截图本页面并联系客服处理",
|
||||
"customer_role_cooldown": "该游戏角色仍在换绑冷却期,请截图本页面并联系客服处理",
|
||||
}
|
||||
return task_issue if messages.get(task_issue) else "binding_failed"
|
||||
@@ -1454,6 +1466,8 @@ def _customer_binding_queue_state(
|
||||
return "allocation_queued", 2000
|
||||
if not lease_ready:
|
||||
return "lease_inactive", 0
|
||||
if task.binding_status == "failed":
|
||||
return "failed", 0
|
||||
if bind_task is None:
|
||||
return "ready_to_start", 0
|
||||
result = bind_task.result or {}
|
||||
|
||||
Reference in New Issue
Block a user