fix: improve IM user account search
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user