使用请求ID搜索访问日志时自动去除多余的空格和句号

This commit is contained in:
刘祥超
2021-12-02 14:44:20 +08:00
parent 4f05671af2
commit aeb2a0c4f9

View File

@@ -330,9 +330,9 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx, lastRequestId string, s
query.Param("intKeyword2", types.Int(pieces[1])) query.Param("intKeyword2", types.Int(pieces[1]))
} }
if regexp.MustCompile(`^\d{20,}$`).MatchString(keyword) { if regexp.MustCompile(`^\d{20,}\s*\.?$`).MatchString(keyword) {
where += " OR requestId=:requestId" where += " OR requestId=:requestId"
query.Param("requestId", keyword) query.Param("requestId", strings.TrimRight(keyword, ". "))
} }
query.Where("("+where+")"). query.Where("("+where+")").