fix(douyu): unify binding state and scheduler health
This commit is contained in:
@@ -17,9 +17,9 @@ from ..models import (
|
||||
PlatformFulfillmentTask,
|
||||
User,
|
||||
)
|
||||
from .account_binding import binding_channel, binding_role_from_result
|
||||
from .account_events_service import EVENT_COLLAB_SYNCED
|
||||
from .audit_service import record_account_action, record_audit
|
||||
from .douyu_binding import BINDING_VIEW_CONFIRMED, resolve_douyu_binding
|
||||
from .douyu_collab_common import (
|
||||
POINTS_THRESHOLD_DEFAULT,
|
||||
SOURCE_TYPE_PLATFORM_FULFILLMENT,
|
||||
@@ -101,15 +101,18 @@ def _apply_platform_fulfillment_binding(
|
||||
if task.bind_task_id
|
||||
else None
|
||||
)
|
||||
result = (
|
||||
bind_task.result if bind_task and isinstance(bind_task.result, dict) else None
|
||||
)
|
||||
role = binding_role_from_result(result)
|
||||
if not role:
|
||||
if bind_task is None:
|
||||
return
|
||||
binding = resolve_douyu_binding(
|
||||
bind_task,
|
||||
account=db.get(Account, int(task.account_id)) if task.account_id else None,
|
||||
)
|
||||
if binding.status != BINDING_VIEW_CONFIRMED:
|
||||
return
|
||||
role = binding.confirmed_role_name
|
||||
if overwrite or not order.bind_game_role:
|
||||
order.bind_game_role = _text(role, max_length=128)
|
||||
channel = binding_channel(result)
|
||||
channel = binding.confirmed_channel
|
||||
if channel and (overwrite or not order.bind_game_channel):
|
||||
order.bind_game_channel = _text(channel, max_length=128)
|
||||
if overwrite or not order.bind_snapshot_at:
|
||||
|
||||
Reference in New Issue
Block a user