Compare commits
5 Commits
0.2.7.8
...
7fa7b42b1a
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fa7b42b1a | |||
| 26452161f8 | |||
| 07d3a4420c | |||
| 2c3c2d6acf | |||
| afc663844b |
@@ -192,5 +192,6 @@ def get_visible_data(current_user):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
生产环境用于创建数据库结构的临时命令:
|
生产环境用于创建数据库结构的临时命令:
|
||||||
python manage.py shell -c "from elastic.es_connect import create_index_with_mapping; create_index_with_mapping()"
|
python manage.py shell -c "from elastic.es_connect import create_index_with_mapping; create_index_with_mapping()"
|
||||||
|
|||||||
@@ -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)}")
|
||||||
|
|||||||
@@ -1027,7 +1027,7 @@ def analytics_types_view(request):
|
|||||||
size_int = int(size) if size is not None else 10
|
size_int = int(size) if size is not None else 10
|
||||||
except Exception:
|
except Exception:
|
||||||
size_int = 10
|
size_int = 10
|
||||||
data = es_analytics_types(gte=gte, lte=lte, size=size_int)
|
data = es_analytics_types(gte=gte, lte=lte, limit=size_int)
|
||||||
return JsonResponse({"status": "success", "data": data})
|
return JsonResponse({"status": "success", "data": data})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return JsonResponse({"status": "error", "message": str(e)}, status=500)
|
return JsonResponse({"status": "error", "message": str(e)}, status=500)
|
||||||
|
|||||||
Reference in New Issue
Block a user