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 }