看板平均响应按协同分发统计;查价失败可从主账恢复;报价模板匹配与填表更稳,后台改名运营后台。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-05 18:00:08 +08:00
co-authored by Cursor
parent e95e8869a6
commit 58df358577
28 changed files with 1493 additions and 245 deletions
+17 -3
View File
@@ -178,7 +178,8 @@ _GENERIC_KEYWORDS = frozenset(
_LAND_KEYWORD_ALIASES = {
"国内拼车": ("国内运输拼车", "拼车"),
"国内零担": ("国内运输拼车", "国内长途/零担", "零担"),
"国内整车": ("国内运输整车", "整车"),
# 「整车」不能当国内整车别名:跨境整车 / 中港整车都含这两个字。
"国内整车": ("国内运输整车",),
"跨境整车": ("跨境整车",),
"跨境集拼": ("跨境集拼",),
"跨境零担": ("跨境集拼",),
@@ -198,6 +199,19 @@ def _keyword_needles(kw: str) -> list[str]:
return out
def _needle_in(text: str, needle: str) -> bool:
"""
陆运针:普通包含。单独「整车」不命中跨境/中港,避免国内整车模板抢走跨境单。
"""
hay = (text or "").lower()
n = (needle or "").strip().lower()
if not hay or not n or n not in hay:
return False
if n == "整车" and ("跨境" in hay or "中港" in hay):
return False
return True
def _keyword_score(raw: Any, haystack: str, type_val: str) -> tuple[int, int]:
"""
运输类型上的命中优先,其次全文词长。
@@ -212,11 +226,11 @@ def _keyword_score(raw: Any, haystack: str, type_val: str) -> tuple[int, int]:
if k in _GENERIC_KEYWORDS:
continue
needles = _keyword_needles(kw)
if type_val and any(n in type_val for n in needles):
if type_val and any(_needle_in(type_val, n) for n in needles):
type_hits += 1
length += len(k)
any_hit = True
elif any(n in haystack for n in needles):
elif any(_needle_in(haystack, n) for n in needles):
length += len(k)
any_hit = True
if not any_hit: