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:
yuzhiran
2026-06-22 11:46:14 +08:00
parent 4d54c8088c
commit d37bbd7a61
2 changed files with 17 additions and 1 deletions
@@ -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([