feat(douyu): unify account probes and lifecycle writes
Centralize Douyu client creation, CK session probing, identity refresh, role alias resolution, capability persistence, cache and batch throttling across collaboration, fulfillment, tasks and cookie management. Add the account-name copy action in the collaboration table.
This commit is contained in:
@@ -19,7 +19,11 @@ from .account_binding import (
|
||||
set_bind_status,
|
||||
)
|
||||
from .business_events import record_exchange
|
||||
from .douyu_activity_query import query_xpd_bind_info
|
||||
from .douyu_activity_query import (
|
||||
query_xpd_bind_info,
|
||||
query_xpd_embed,
|
||||
query_xpd_role,
|
||||
)
|
||||
|
||||
DOUYU_XPD_BIND_POLL_SECONDS = 300
|
||||
DOUYU_XPD_BIND_POLL_INTERVAL = 5
|
||||
@@ -43,11 +47,13 @@ class XpdMixin:
|
||||
|
||||
def _xpd_role_context(self, client: DouyuActivityClient, config: dict) -> dict:
|
||||
"""获取小店 H5 参数 + 绑定角色信息,小店任务共用。"""
|
||||
embed = client.xpd_embed_query(
|
||||
embed = query_xpd_embed(
|
||||
client,
|
||||
act_alias=str(config["xpd_act_alias"]),
|
||||
rid=str(config["xpd_rid"]),
|
||||
)
|
||||
role = client.xpd_get_role(
|
||||
role = query_xpd_role(
|
||||
client,
|
||||
embed_query=embed["query"],
|
||||
act_id=str(config["xpd_act_id"]),
|
||||
rid=str(config["xpd_rid"]),
|
||||
@@ -456,7 +462,8 @@ class XpdMixin:
|
||||
):
|
||||
"""查询和平小店道聚城购买记录。"""
|
||||
client = self._client(cookie)
|
||||
embed = client.xpd_embed_query(
|
||||
embed = query_xpd_embed(
|
||||
client,
|
||||
act_alias=str(config["xpd_act_alias"]),
|
||||
rid=str(config["xpd_rid"]),
|
||||
)
|
||||
@@ -528,13 +535,15 @@ class XpdMixin:
|
||||
return
|
||||
|
||||
client = self._client(cookie)
|
||||
embed = client.xpd_embed_query(
|
||||
embed = query_xpd_embed(
|
||||
client,
|
||||
act_alias=str(config["xpd_act_alias"]),
|
||||
rid=str(config["xpd_rid"]),
|
||||
)
|
||||
role: dict = {}
|
||||
try:
|
||||
role = client.xpd_get_role(
|
||||
role = query_xpd_role(
|
||||
client,
|
||||
embed_query=embed["query"],
|
||||
act_id=str(config["xpd_act_id"]),
|
||||
rid=str(config["xpd_rid"]),
|
||||
|
||||
Reference in New Issue
Block a user