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:
@@ -34,7 +34,6 @@ from web.backend.services.automation.jobs import (
|
||||
platform_fulfillment_lease_reaper as reaper,
|
||||
)
|
||||
from web.backend.services.douyu_account_state import DouyuLiveAccountState
|
||||
from web.backend.services.douyu_activity_query import DouyuEligibilityResult
|
||||
from web.backend.services.platform_fulfillment import account_selector, service
|
||||
|
||||
NOW = datetime.now(UTC).replace(microsecond=0)
|
||||
@@ -2145,14 +2144,26 @@ class TestBindingAndCompletion(_Base):
|
||||
self.session.commit()
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"query_exchange_eligibility",
|
||||
lambda *_args, **_kwargs: DouyuEligibilityResult(
|
||||
elite_user_info={"manual_type": 1},
|
||||
points=100,
|
||||
points_response={"points": 100},
|
||||
limited_goods=[],
|
||||
limited_ids=frozenset(),
|
||||
),
|
||||
"probe_account",
|
||||
lambda *_args, **_kwargs: {
|
||||
"probe_id": "points-short",
|
||||
"session": {"status": "valid", "message": "有效"},
|
||||
"elite": {
|
||||
"status": "ok",
|
||||
"raw": {"manual_type": 1},
|
||||
"manual_type": 1,
|
||||
"manual_score": 100,
|
||||
"opened": True,
|
||||
},
|
||||
"eligibility": {
|
||||
"points": 100,
|
||||
"points_response": {"points": 100},
|
||||
"limited_ids": [],
|
||||
"limited_goods": [],
|
||||
},
|
||||
"roles": {},
|
||||
"errors": {},
|
||||
},
|
||||
)
|
||||
|
||||
detail = service.refresh_exchange_eligibility(
|
||||
@@ -2175,14 +2186,27 @@ class TestBindingAndCompletion(_Base):
|
||||
self.session.commit()
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"query_exchange_eligibility",
|
||||
lambda *_args, **_kwargs: DouyuEligibilityResult(
|
||||
elite_user_info={"manual_type": 1, "expire_time": 1},
|
||||
points=2000,
|
||||
points_response={"points": 2000},
|
||||
limited_goods=[],
|
||||
limited_ids=frozenset(),
|
||||
),
|
||||
"probe_account",
|
||||
lambda *_args, **_kwargs: {
|
||||
"probe_id": "expired-elite",
|
||||
"session": {"status": "valid", "message": "有效"},
|
||||
"elite": {
|
||||
"status": "ok",
|
||||
"raw": {"manual_type": 1, "expire_time": 1},
|
||||
"manual_type": 1,
|
||||
"manual_score": 2000,
|
||||
"expire_time": 1,
|
||||
"opened": False,
|
||||
},
|
||||
"eligibility": {
|
||||
"points": 2000,
|
||||
"points_response": {"points": 2000},
|
||||
"limited_ids": [],
|
||||
"limited_goods": [],
|
||||
},
|
||||
"roles": {},
|
||||
"errors": {},
|
||||
},
|
||||
)
|
||||
|
||||
detail = service.refresh_exchange_eligibility(
|
||||
|
||||
Reference in New Issue
Block a user