fix(fulfillment): 客户资料渠道比对兼容线上手Q标签

- 线上账号渠道为微信/手Q,不能直接用QQ比较
- 补充手Q+苹果渠道匹配测试
This commit is contained in:
yml
2026-11-24 22:38:21 +08:00
parent 9feb6f4bf4
commit 7dec3c4c48
2 changed files with 25 additions and 2 deletions
+18
View File
@@ -3246,6 +3246,24 @@ class TestBindingAndCompletion(_Base):
== 1
)
def test_customer_profile_matches_online_qq_channel_label(self):
task = self._allocated()
account = self.session.get(Account, task.account_id)
account.game_name = "手Q角色"
account.game_channel = "手Q · 苹果(iOS)"
self.session.commit()
detail = service.save_customer_profile(
self.session,
task_id=task.id,
customer_role_name="手Q角色",
platform="qq",
system="ios",
home_images=[{"url": "https://example.com/qq-home.png"}],
)
assert detail["customerProfile"]["channelMatched"] is True
def test_customer_profile_requires_home_image(self):
task = self._allocated()
with pytest.raises(HTTPException) as exc_info:
@@ -710,10 +710,15 @@ def _customer_profile_out(
if role and platform_role:
role_matched = role == platform_role
channel_matched: bool | None = None
# 线上账号渠道写作「微信 / 手Q」,QQ 不能直接拿 "QQ" 去比。
customer_channel = " ".join(
[
"微信" if task.customer_platform == "wechat" else ("QQ" if task.customer_platform == "qq" else ""),
"苹果" if task.customer_system == "ios" else ("安卓" if task.customer_system == "android" else ""),
"微信"
if task.customer_platform == "wechat"
else ("手Q" if task.customer_platform == "qq" else ""),
"苹果"
if task.customer_system == "ios"
else ("安卓" if task.customer_system == "android" else ""),
]
).strip()
account_channel = str(