refactor(douyu): 统一腾讯角色绑定协议与状态判断
This commit is contained in:
@@ -297,6 +297,7 @@ def _probe_with_client(
|
||||
)
|
||||
elite = overview["elite"]
|
||||
bind = overview["bind"]
|
||||
bind_snapshot = overview["bind_snapshot"]
|
||||
gold = overview["gold"]
|
||||
goods = overview["serialized_goods"]
|
||||
error_labels = {
|
||||
@@ -315,13 +316,13 @@ def _probe_with_client(
|
||||
expire_time = _to_int(elite.get("expire_time"))
|
||||
user_info = elite.get("user_info") or {}
|
||||
profile = DouyuActivityClient.profile_from_cookie(str(account.cookie or ""))
|
||||
bind_role = _text(bind.get("role_name"), max_length=128)
|
||||
area_name = _text(bind.get("area_name"), max_length=64)
|
||||
plat_name = _text(bind.get("plat_name"), max_length=64)
|
||||
bind_role = _text(bind_snapshot["role_name"], max_length=128)
|
||||
area_name = _text(bind_snapshot["area_name"], max_length=64)
|
||||
plat_name = _text(bind_snapshot["plat_name"], max_length=64)
|
||||
bind_channel = " · ".join(item for item in (area_name, plat_name) if item)
|
||||
bind_account = _text(bind.get("nickname"), max_length=128)
|
||||
bind_account = _text(bind_snapshot["nickname"], max_length=128)
|
||||
ck_status = CK_VALID if (elite or bind) else CK_INVALID
|
||||
ok = bool(bind_role) and not (elite == {} and bind == {})
|
||||
ok = bool(bind_snapshot["bind_confirmed"]) and not (elite == {} and bind == {})
|
||||
|
||||
return {
|
||||
"found": True,
|
||||
@@ -340,6 +341,8 @@ def _probe_with_client(
|
||||
"manual_score": manual_score,
|
||||
"expire_time": expire_time,
|
||||
"manual_opened": bool(manual_type is not None and manual_type >= 1),
|
||||
"bind_status": bind_snapshot["bind_status"],
|
||||
"bind_phase": bind_snapshot["bind_phase"],
|
||||
"bind_game_account": bind_account,
|
||||
"bind_game_role": bind_role,
|
||||
"bind_game_channel": bind_channel,
|
||||
|
||||
Reference in New Issue
Block a user