[0.2.8.0][ci]

This commit is contained in:
DSQ
2026-03-23 11:51:02 +08:00
parent 9e3fe7150b
commit 26452161f8

View File

@@ -831,12 +831,8 @@ def get_user_by_username(username):
def get_all_users(): def get_all_users():
"""获取所有用户""" """获取所有用户"""
try: try:
search = UserDocument.search()
search = search.query("match_all")
response = search.execute()
users = [] users = []
for hit in response: for hit in UserDocument.search().query("match_all").scan():
users.append({ users.append({
"user_id": hit.user_id, "user_id": hit.user_id,
"username": hit.username, "username": hit.username,
@@ -848,7 +844,6 @@ def get_all_users():
"key": list(getattr(hit, 'key', []) or []), "key": list(getattr(hit, 'key', []) or []),
"manage_key": list(getattr(hit, 'manage_key', []) or []), "manage_key": list(getattr(hit, 'manage_key', []) or []),
}) })
return users return users
except Exception as e: except Exception as e:
print(f"获取所有用户失败: {str(e)}") print(f"获取所有用户失败: {str(e)}")