From b83f20c6b7829ccc47d6ee4e58c6fb6ce4be16a3 Mon Sep 17 00:00:00 2001 From: QiuSW <105186638@qq.com> Date: Mon, 14 Sep 2026 10:52:02 +0800 Subject: [PATCH] fix(syb): accept descriptive color specs (#274) --- server/app/goauto/sybimport/parse.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/server/app/goauto/sybimport/parse.go b/server/app/goauto/sybimport/parse.go index 95fddf0..0b56c81 100644 --- a/server/app/goauto/sybimport/parse.go +++ b/server/app/goauto/sybimport/parse.go @@ -25,7 +25,6 @@ var explicitSizePattern = regexp.MustCompile(`(?i)^(?:均(?:码|碼|号|號)|one // Observed in the real SYB sample: "黑色+白色【純棉兩件裝】 簡約親膚" strips // its bracket to "黑色+白色 簡約親膚", which still carries a '+' and internal // whitespace, so it must not be reported as a confident match. -var ambiguousPattern = regexp.MustCompile(`[++\s]`) // ParseResult is the color/size candidate extracted from one productSpec // string, plus how much the caller should trust it. @@ -91,7 +90,7 @@ func Parse(raw string) ParseResult { if explicitSizePattern.MatchString(only) { return ParseResult{Size: only, Status: models.SYBParseStatusSuccess, Note: "仅识别到尺码"} } - if only != "" && !ambiguousPattern.MatchString(only) { + if only != "" { return ParseResult{Color: only, Status: models.SYBParseStatusSuccess, Note: "仅识别到颜色"} } return ParseResult{Color: colorPart, Size: sizePart, Status: models.SYBParseStatusFailed, Note: "按逗号拆分后没有可靠规格"} @@ -103,9 +102,6 @@ func Parse(raw string) ParseResult { if firstIsSize { colorPart, sizePart = secondPart, firstPart } - if ambiguousPattern.MatchString(colorPart) { - return ParseResult{Color: colorPart, Size: sizePart, Status: models.SYBParseStatusUncertain, Note: "颜色部分含备注文本或多个分隔符,拆分结果可能不准确"} - } return ParseResult{Color: colorPart, Size: sizePart, Status: models.SYBParseStatusSuccess} }