fix(douyu): 区分平台账号与客户游戏账号换绑冷却
This commit is contained in:
@@ -392,7 +392,8 @@ alias 上的旧角色,不能把 `cjm` 的新角色写入账号库。
|
||||
- `bindAct=0` 是 pending,可以在发新二维码前已经存在;
|
||||
- `bindAct=1` 是 bound,即使同时返回 `needBindAct=1` 也不是 pending;
|
||||
- 不要把 `needBindAct=1` 单独当成本轮扫码结果;
|
||||
- `actBind=-200001` 是当前斗鱼账号冷却,不是客户游戏角色冷却;
|
||||
- `actBind=-200001` 必须结合文案区分:含“该平台账号未到可换绑时间”是当前
|
||||
斗鱼账号冷却,含“该账号未到可换绑时间”是客户游戏账号冷却;
|
||||
- `actBind` 失败后必须保留旧绑定,不能写入新扫码角色;
|
||||
- 不要在页面层重新实现 `bindAct/needBindAct` 判断;
|
||||
- 不要把原始 `bind_summary` 当业务文案,它只用于排障。
|
||||
|
||||
@@ -18,6 +18,7 @@ from web.backend.services.account_binding import (
|
||||
binding_snapshot,
|
||||
derive_from_bind_info,
|
||||
is_pending_binding_role,
|
||||
is_platform_account_bind_cooldown,
|
||||
is_role_change_cooling,
|
||||
pending_binding_role_from_result,
|
||||
role_change_available_at,
|
||||
@@ -616,6 +617,14 @@ def test_confirm_bind_preserves_platform_cooldown_error_code(monkeypatch):
|
||||
assert exc_info.value.payload == payload
|
||||
|
||||
|
||||
def test_bind_cooldown_messages_distinguish_platform_and_customer_accounts():
|
||||
customer_message = "该账号未到可换绑时间,请使用其他账号"
|
||||
platform_message = "该平台账号未到可换绑时间,请使用其他平台账号"
|
||||
|
||||
assert is_platform_account_bind_cooldown(-200001, customer_message) is False
|
||||
assert is_platform_account_bind_cooldown(-200001, platform_message) is True
|
||||
|
||||
|
||||
def test_get_bind_qr_uses_role_param_url_for_mini_qrcode(monkeypatch):
|
||||
client = DouyuActivityClient("acf_ccn=ctn")
|
||||
monkeypatch.setattr(
|
||||
|
||||
@@ -2512,6 +2512,8 @@ class TestBindingAndCompletion(_Base):
|
||||
"role_name": "测试角色",
|
||||
"bind_ready_for_confirm": True,
|
||||
"bind_confirmed": False,
|
||||
"confirm_error": "该账号未到可换绑时间,请使用其他账号",
|
||||
"confirm_error_code": -200001,
|
||||
},
|
||||
created_by=self.admin_id,
|
||||
)
|
||||
|
||||
@@ -291,17 +291,21 @@ def is_platform_account_bind_cooldown(
|
||||
) -> bool:
|
||||
"""是否为斗鱼平台账号自身的换绑冷却。
|
||||
|
||||
2026-11-22 换绑失败 HAR 中 ``actBind`` 返回 ``-200001``:
|
||||
“该平台账号未到可换绑时间,请使用其他平台账号”。它限制的是当前斗鱼号,
|
||||
不是用户扫码选择的腾讯游戏角色;提示和人工处理都必须区分两者。
|
||||
两种冷却都是 ``-200001``,必须继续用文案区分:
|
||||
|
||||
- “该平台账号未到可换绑时间,请使用其他平台账号”:斗鱼账号冷却;
|
||||
- “该账号未到可换绑时间,请使用其他账号”:客户游戏账号冷却。
|
||||
"""
|
||||
try:
|
||||
normalized_code = int(error_code)
|
||||
except (TypeError, ValueError):
|
||||
normalized_code = None
|
||||
return normalized_code == -200001 or "该平台账号未到可换绑时间" in (
|
||||
message or ""
|
||||
)
|
||||
text = str(message or "")
|
||||
if "该平台账号未到可换绑时间" in text:
|
||||
return True
|
||||
if "该账号未到可换绑时间" in text or "请使用其他账号" in text:
|
||||
return False
|
||||
return normalized_code == -200001
|
||||
|
||||
|
||||
def binding_pending_decision(
|
||||
|
||||
Reference in New Issue
Block a user