fix: improve IM user account search

This commit is contained in:
richjohnrambo
2026-08-19 17:23:36 +08:00
parent b3d18f9d8d
commit 73ddb2d9fa
4 changed files with 87 additions and 4 deletions
+6 -2
View File
@@ -7132,8 +7132,12 @@ func (a *adapter) TenantUserSearch(id t.TenantID, viewer t.Uid, queryText, searc
switch searchType {
case "", "account":
like := "%" + queryText + "%"
where = append(where, "(profile.nickname LIKE ? OR profile.public_account LIKE ? OR CAST(u.public AS CHAR) LIKE ? OR u.id=?)")
args = append(args, like, like, like, userIDNumericArg(queryText))
phoneCandidate := queryText
if phone, err := normalizeUserPhone(queryText); err == nil {
phoneCandidate = phone
}
where = append(where, "(profile.nickname LIKE ? OR profile.public_account LIKE ? OR u.username LIKE ? OR u.phone=? OR u.phone=? OR CAST(u.public AS CHAR) LIKE ? OR u.id=?)")
args = append(args, like, like, like, queryText, phoneCandidate, like, userIDNumericArg(queryText))
case "exact_account":
where = append(where, "(profile.public_account=? OR u.username=? OR u.id=?)")
args = append(args, queryText, strings.TrimPrefix(queryText, "basic:"), userIDNumericArg(queryText))