fix(admin): add wxOpenid to fuzzy search, enhance admin tab info

- Backend getUsers: add wxOpenid to  regex search
- Backend getAdmins: return gravity, plan, wxOpenid, email fields
- Frontend admin tab: show full user info (ID copy, email, gravity, plan)
- Frontend search result: show complete user details like user list rows
This commit is contained in:
yuzhiran
2026-06-22 12:07:52 +08:00
parent d37bbd7a61
commit 70c4f28eb5
2 changed files with 45 additions and 17 deletions
@@ -86,6 +86,7 @@ export class AdminController {
{ phone: { $regex: escaped, $options: 'i' } },
{ nickname: { $regex: escaped, $options: 'i' } },
{ email: { $regex: escaped, $options: 'i' } },
{ wxOpenid: { $regex: escaped, $options: 'i' } },
]
// 支持按 MongoDB _id 搜索(24位 hex
if (/^[0-9a-f]{24}$/i.test(keyword)) {
@@ -250,7 +251,7 @@ export class AdminController {
@Get('admins')
async getAdmins() {
const admins = await this.userModel.find({ role: 'admin' }).select('phone nickname email createdAt isSystemAdmin').lean().exec()
const admins = await this.userModel.find({ role: 'admin' }).select('phone nickname email wxOpenid gravity plan role createdAt isSystemAdmin').lean().exec()
return { admins }
}