補強 PChome 比對商業條件防線
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s

This commit is contained in:
OoO
2026-05-25 19:00:07 +08:00
parent bd33f7ff60
commit 6c5854bb5f
5 changed files with 50 additions and 2 deletions

View File

@@ -1976,7 +1976,13 @@ def score_marketplace_match(
nitori_diffuser_model_conflict = _has_nitori_diffuser_model_conflict(left, right)
if nitori_diffuser_model_conflict:
reasons.append("nitori_diffuser_model_conflict")
variant_selection_review = _has_named_variant_selection_review(left, right, shared_anchor)
commercial_condition_gap = _has_commercial_condition_gap(left, right)
if commercial_condition_gap:
reasons.append("commercial_condition_gap")
variant_selection_review = (
_has_named_variant_selection_review(left, right, shared_anchor)
or commercial_condition_gap
)
if variant_selection_review:
reasons.append("variant_selection_review")
@@ -3070,6 +3076,24 @@ def _has_makeup_shade_selection_gap(left: ProductIdentity, right: ProductIdentit
return bool(left_shades) != bool(right_shades)
def _commercial_condition_terms(identity: ProductIdentity) -> set[str]:
text = identity.normalized_name
terms: set[str] = set()
if any(term in text for term in ("即期品", "臨期", "短效", "短效期", "效期", "保存期限", "有效期限")):
terms.add("expiry_sensitive")
if any(term in text for term in ("盒損", "盒損品", "外盒損", "外盒瑕疵")):
terms.add("box_damage")
if any(term in text for term in ("福利品", "瑕疵品")):
terms.add("clearance_condition")
return terms
def _has_commercial_condition_gap(left: ProductIdentity, right: ProductIdentity) -> bool:
left_terms = _commercial_condition_terms(left)
right_terms = _commercial_condition_terms(right)
return bool(left_terms or right_terms) and left_terms != right_terms
def _has_taicend_baby_spray_equivalence(left: ProductIdentity, right: ProductIdentity) -> bool:
brand_tokens = {"taicend", "泰陞"}
return (