feat: add xpd purchase records view

This commit is contained in:
yml2213
2026-08-08 21:41:44 +08:00
parent 948e7d7246
commit a342dddcb6
5 changed files with 300 additions and 2 deletions
+30
View File
@@ -1429,6 +1429,35 @@ class DouyuBatchRunner:
{"fragments": fragments, "role": role, "area_id": int(areaid)},
)
def _execute_query_xpd_purchase_records(
self,
db: Session,
task: DouyuTask,
account: Account,
cookie: str,
config: dict,
):
"""查询和平小店道聚城购买记录。"""
client = self._client(cookie)
embed = client.xpd_embed_query(
act_alias=str(config["xpd_act_alias"]),
rid=str(config["xpd_rid"]),
)
result = client.xpd_purchase_records(
embed_query=embed["query"],
act_id=str(config["xpd_act_id"]),
)
account.xpd_bind_status = "xpd_purchase_records_queried"
account.updated_at = datetime.now(timezone.utc)
total = result.get("total") or len(result.get("records") or [])
self._mark_task(
db,
task,
"success",
f"小店兑换记录 {total}" if total else "暂无小店兑换记录",
result,
)
def _execute_exchange_xpd_goods(
self,
db: Session,
@@ -2821,6 +2850,7 @@ class DouyuBatchRunner:
"refresh_xpd_goods": self._execute_refresh_xpd_goods,
"query_xpd_balance": self._execute_query_xpd_balance,
"query_xpd_fragments": self._execute_query_xpd_fragments,
"query_xpd_purchase_records": self._execute_query_xpd_purchase_records,
"exchange_xpd_goods": self._execute_exchange_xpd_goods,
}.get(task.task_type)
if handler is None: