diff --git a/tests/test_platform_fulfillment.py b/tests/test_platform_fulfillment.py index bcac252..e9baa58 100644 --- a/tests/test_platform_fulfillment.py +++ b/tests/test_platform_fulfillment.py @@ -924,6 +924,40 @@ class TestBindingAndCompletion(_Base): assert detail["task"]["bindTask"]["roleName"] == "少和我较劲" assert detail["task"]["bindTask"]["bindReadyForConfirm"] is True + def test_confirmed_binding_is_not_reported_as_waiting_for_confirmation(self): + task = self._allocated() + bind_task = DouyuTask( + batch_id="bind-confirmed", + account_id=task.account_id, + account_assigned_to=self.admin_id, + task_type="confirm_bind", + handbook_scope="elite", + status="success", + result={ + "role_name": "洋崽想要躺鸡", + "need_bind_act": True, + "is_bound_act": True, + "bind_ready_for_confirm": True, + "bind_confirmed": True, + "bind_phase": "confirmed", + }, + created_by=self.admin_id, + ) + self.session.add(bind_task) + self.session.flush() + task.bind_task_id = bind_task.id + task.binding_status = "bound" + task.execution_status = "bound" + self.session.commit() + + live = service.customer_binding_out(self.session, task.id) + detail = service.get_task_detail(self.session, task.id) + + assert live["roleName"] == "洋崽想要躺鸡" + assert live["bindConfirmed"] is True + assert live["bindReadyForConfirm"] is False + assert detail["task"]["bindTask"]["bindReadyForConfirm"] is False + def test_refresh_binding_clears_stale_failure_when_qr_is_pending(self): task = self._allocated() bind_task = DouyuTask( diff --git a/web/backend/services/platform_fulfillment/service.py b/web/backend/services/platform_fulfillment/service.py index 42372b0..9743785 100644 --- a/web/backend/services/platform_fulfillment/service.py +++ b/web/backend/services/platform_fulfillment/service.py @@ -515,7 +515,9 @@ def list_tasks( def _pending_binding_role_name(result: dict[str, Any]) -> str: - if not bool(result.get("bind_ready_for_confirm")): + if bool(result.get("bind_confirmed")) or not bool( + result.get("bind_ready_for_confirm") + ): return "" role_name = str(result.get("role_name") or "").strip() if not role_name: