feat(admin): fuzzy search by email/ID, display full userId in user list
- Backend: add email + _id to filter in getUsers() for fuzzy search - Frontend: show full MongoDB _id in user row with tap-to-copy - Search placeholder updated to mention email/ID
This commit is contained in:
@@ -85,7 +85,12 @@ export class AdminController {
|
||||
filter.$or = [
|
||||
{ phone: { $regex: escaped, $options: 'i' } },
|
||||
{ nickname: { $regex: escaped, $options: 'i' } },
|
||||
{ email: { $regex: escaped, $options: 'i' } },
|
||||
]
|
||||
// 支持按 MongoDB _id 搜索(24位 hex)
|
||||
if (/^[0-9a-f]{24}$/i.test(keyword)) {
|
||||
filter.$or.push({ _id: keyword })
|
||||
}
|
||||
}
|
||||
const skip = (Math.max(1, +page) - 1) * +limit
|
||||
const [users, total] = await Promise.all([
|
||||
|
||||
Reference in New Issue
Block a user