From 2d7f605270897f280cc373559cb23866c1cf8a15 Mon Sep 17 00:00:00 2001 From: yml Date: Wed, 25 Nov 2026 14:14:30 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=BF=AE=E5=A4=8D(=E5=B1=A5=E7=BA=A6?= =?UTF-8?q?=E9=80=89=E5=8F=B7):=20=E6=8C=89=E5=AE=A2=E6=88=B7QQ/=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E3=80=81iOS/=E5=AE=89=E5=8D=93=E5=92=8C=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E4=BC=98=E5=85=88=E9=80=89=E5=8F=B7"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 522ab9310ce57ab3eded0effaf6520feae1b326b. --- tests/test_platform_fulfillment.py | 21 -------- .../platform_fulfillment/account_selector.py | 49 +------------------ .../platform_fulfillment/allocation.py | 3 -- 3 files changed, 1 insertion(+), 72 deletions(-) diff --git a/tests/test_platform_fulfillment.py b/tests/test_platform_fulfillment.py index 554b449..12c8811 100644 --- a/tests/test_platform_fulfillment.py +++ b/tests/test_platform_fulfillment.py @@ -1359,27 +1359,6 @@ class TestAccountSelection(_Base): == 1 ) - def test_capability_candidates_filter_customer_channel_and_prefer_exact_role( - self, - ): - matching = self.account("channel-role-match", role_available_at=NOW + timedelta(days=7)) - matching.game_name = "再说就一坨儿" - matching.game_channel = "手Q · 安卓(android)" - wrong_channel = self.account("channel-wrong") - wrong_channel.game_name = "小无恩" - wrong_channel.game_channel = "微信 / 安卓(android)" - self.session.commit() - - candidates = account_selector.capability_candidate_rows( - self.session, - commodity_id=COMMODITY, - customer_role_name="再说就一坨儿", - customer_platform="qq", - customer_system="android", - ) - - assert [item.account.id for item in candidates] == [matching.id] - def test_capability_match_uses_local_index_without_live_probe(self): account = self.account("capability-fast", capability=False) task = self.task() diff --git a/web/backend/services/platform_fulfillment/account_selector.py b/web/backend/services/platform_fulfillment/account_selector.py index cd149cd..4b2b629 100644 --- a/web/backend/services/platform_fulfillment/account_selector.py +++ b/web/backend/services/platform_fulfillment/account_selector.py @@ -261,31 +261,6 @@ def live_candidate_accounts( return rows -def _customer_channel_filter( - customer_platform: str, - customer_system: str, -): - """客户填写的 QQ/微信、iOS/安卓对应到账号渠道。""" - platform = str(customer_platform or "").strip().lower() - system = str(customer_system or "").strip().lower() - filters = [] - if platform == "qq": - filters.append( - or_(Account.game_channel.like("%手Q%"), Account.game_channel.like("%QQ%")) - ) - elif platform == "wechat": - filters.append(Account.game_channel.like("%微信%")) - if system == "ios": - filters.append( - or_(Account.game_channel.like("%苹果%"), Account.game_channel.like("%iOS%")) - ) - elif system == "android": - filters.append( - or_(Account.game_channel.like("%安卓%"), Account.game_channel.like("%android%")) - ) - return and_(*filters) if filters else None - - def _capability_candidate_query( db: Session, *, @@ -295,9 +270,6 @@ def _capability_candidate_query( limit: int = 20, now: datetime | None = None, allow_before_open: bool = False, - customer_role_name: str = "", - customer_platform: str = "", - customer_system: str = "", ): commodity = commodity_id.strip() if not commodity: @@ -308,11 +280,6 @@ def _capability_candidate_query( moment, allow_before_open=allow_before_open, ) - channel_filter = _customer_channel_filter(customer_platform, customer_system) - role = str(customer_role_name or "").strip() - role_filter = role_change_ready_filter(moment) - if role: - role_filter = or_(role_filter, Account.game_name == role) return ( db.query( Account.id.label("account_id"), @@ -348,14 +315,12 @@ def _capability_candidate_query( cookie_present_filter(), valid_ck_filter(), automatable_account_filter(), - role_filter, - channel_filter if channel_filter is not None else and_(True), + role_change_ready_filter(moment), assigned_to_pool_filter(), ~active_lease_exists(), ~active_collab_order_exists(), ) .order_by( - case((Account.game_name == role, 0), else_=1) if role else case((True, 0), else_=1), case( (AccountCommodityState.offer_state == OFFER_STATE_ACTIVE, 0), else_=1, @@ -384,9 +349,6 @@ def capability_candidate_rows( limit: int = 20, now: datetime | None = None, allow_before_open: bool = False, - customer_role_name: str = "", - customer_platform: str = "", - customer_system: str = "", ) -> list[CapabilityCandidate]: """读取账号与能力快照;只访问本地数据库,不触发官网请求。""" query = _capability_candidate_query( @@ -397,9 +359,6 @@ def capability_candidate_rows( limit=limit, now=now, allow_before_open=allow_before_open, - customer_role_name=customer_role_name, - customer_platform=customer_platform, - customer_system=customer_system, ) if query is None: return [] @@ -475,9 +434,6 @@ def capability_candidate_accounts( limit: int = 20, now: datetime | None = None, allow_before_open: bool = False, - customer_role_name: str = "", - customer_platform: str = "", - customer_system: str = "", ) -> list[CapabilityAccount]: """从新鲜的商品能力索引读取候选账号,不产生外部请求。""" return [ @@ -490,9 +446,6 @@ def capability_candidate_accounts( limit=limit, now=now, allow_before_open=allow_before_open, - customer_role_name=customer_role_name, - customer_platform=customer_platform, - customer_system=customer_system, ) ] diff --git a/web/backend/services/platform_fulfillment/allocation.py b/web/backend/services/platform_fulfillment/allocation.py index 105049c..634da67 100644 --- a/web/backend/services/platform_fulfillment/allocation.py +++ b/web/backend/services/platform_fulfillment/allocation.py @@ -363,9 +363,6 @@ def _allocate_task_from_capability( scope=task.scope or SCOPE_ELITE, now=moment, allow_before_open=is_presale, - customer_role_name=task.customer_role_name or "", - customer_platform=task.customer_platform or "", - customer_system=task.customer_system or "", ) recent_exchange_ids: set[int] = set() if capability_candidates: