From 3c79cc1ad2648f5f7a9be66a8608c8048ae4b8c4 Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 10 Jun 2025 14:09:24 +0800 Subject: [PATCH] =?UTF-8?q?update:=20au=5Fsim=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/au_sim.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cmd/au_sim.go b/cmd/au_sim.go index 471171f..f633c6a 100644 --- a/cmd/au_sim.go +++ b/cmd/au_sim.go @@ -247,6 +247,32 @@ func extractInfoFromOCR(texts []string) ExtractedInfo { info.Amount = match2[1] } } + //到这里要判断一下是不是压根没充值,还是没找到再去全文正则匹配纯100、200、50 + if info.Amount == "" { + if strings.Contains(combined, "未充值") { + info.Amount = "未充值" + } + } + + //如果到这一步充值金额还没找到,再通过正则去找纯100、200、50 + /* + "100", // 匹配 + "200", // 匹配 + "50", // 匹配 + "1003", // 不匹配 + "5004", // 不匹配 + "2004", // 不匹配 + "充值200", // 匹配 + "充值2004", // 不匹配 + "abc100xyz", // 不匹配 + */ + if info.Amount == "" { + re3 := regexp.MustCompile(`\b(100|200|50)\b`) + match3 := re3.FindStringSubmatch(combined) + if len(match3) == 2 { + info.Amount = match3[1] + } + } return info }