add quntiganhi and gptfenxi

This commit is contained in:
2024-11-18 14:54:36 +08:00
parent 9434b11aef
commit 322edcf1e4
13 changed files with 186 additions and 435 deletions
+41 -6
View File
@@ -205,6 +205,29 @@ def to_qunti(request):
sui8 = []
sui9 = []
# 遍历所有记录
import requests
def download_text_file(url,id):
# 发送GET请求
response = requests.get(url)
# 确保请求成功
response.raise_for_status()
# 读取内容
content = response.text
# 将内容写入本地文件
with open(f'{id}.txt', 'w', encoding='utf-8') as file:
file.write(content)
print("文件下载并保存成功。")
id_down = request.GET.get('id')
# 使用函数下载文件
download_url = f'http://192.168.1.13:9001/p/{id_down}/export/txt' # 替换成你的文件URL
download_text_file(download_url,id_down)
# 打开文件
with open(f'{id_down}.txt', 'r', encoding='utf-8') as file:
# 读取整个文件内容
content = file.read()
# 打印内容
print(content)
chat_content.append(content)
for stu in all_student:
class_name = json.loads(stu.select_class)['class']
xiaozu = json.loads(stu.select_xiaozu)['xiaozu']
@@ -227,16 +250,28 @@ def to_qunti(request):
chat_info = Chat_info.objects.filter(user_chat_name=stu.username).values('chat_content')
id = MindUser.objects.get(username=stu.username).id
pinglun_info = Comment.objects.filter(user_id=id).values('comment_content')
content = CooperationMind.objects.get(id=request.GET.get('id')).snapshot_data
# 定义要删除的键
# def extract_topics(data):
# topics = []
# if 'topic' in data:
# topics.append(data['topic'])
# if 'children' in data:
# for child in data['children']:
# topics.extend(extract_topics(child))
# return topics
# print(extract_topics(content))
chat_content.append(content)
print("-----------------------------------------------")
print(len(chat_info))
sui2.append(len(chat_info))
sui1.append(len(pinglun_info))
if len(chat_info) != 0:
for i in range(len(chat_info)):
chat_content.append(chat_info[i]['chat_content'])
if len(pinglun_info) != 0:
for i in range(len(pinglun_info)):
chat_content.append(pinglun_info[i]['comment_content'])
# if len(chat_info) != 0:
# for i in range(len(chat_info)):
# chat_content.append(chat_info[i]['chat_content'])
# if len(pinglun_info) != 0:
# for i in range(len(pinglun_info)):
# chat_content.append(pinglun_info[i]['comment_content'])
print("-----------------------------------------------")
print(pinglun_info)
# chat_content.append()
+37 -36
View File
@@ -59,42 +59,43 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
else:
# 查询列表
if 'b9b101e' == page_tag:
# belong_to = []
old_class = json.loads(user.select_class)['class']
old_xiaozu = json.loads(user.select_xiaozu)['xiaozu']
# for select_class,select_xiaozu in (old_class,old_xiaozu):
# belong_to = ["class1","class2"]
# ["class1"]
# new_belong = json.dumps({'belong': belong_to})
# 我的文件
aa = []
zipped_lists = zip(old_class, old_xiaozu)
for select_class,select_xiaozu in zipped_lists:
belong_to = []
belong_to.append(str(select_class + str(select_xiaozu)))
new_belong = json.dumps({'belong': belong_to})
print(new_belong)
aa.append(CooperationMind.objects.filter(belong_to=new_belong, deleted=0).values('id', 'coop_mind_name',
"client_uuid",
"data_format"))
# queryset.save()
# for i in range(len(aa) - 1):
# if i == 0:
# bb = str(aa[i])
# bb = bb + "|" + str(aa[i + 1])
if len(aa) -1 == 0:
self.queryset = aa[0]
elif len(aa) == 0:
self.queryset = 0
else:
for i in range(len(aa) -1):
if i == 0:
self.queryset = aa[i]
self.queryset = self.queryset | aa[i + 1]
print("=============================")
print(self.queryset)
print("=============================")
self.queryset = CooperationMind.objects.all()
# # belong_to = []
# old_class = json.loads(user.select_class)['class']
# old_xiaozu = json.loads(user.select_xiaozu)['xiaozu']
# # for select_class,select_xiaozu in (old_class,old_xiaozu):
# # belong_to = ["class1","class2"]
# # ["class1"]
# # new_belong = json.dumps({'belong': belong_to})
# # 我的文件
# aa = []
# zipped_lists = zip(old_class, old_xiaozu)
# for select_class,select_xiaozu in zipped_lists:
# belong_to = []
# belong_to.append(str(select_class + str(select_xiaozu)))
# new_belong = json.dumps({'belong': belong_to})
# print(new_belong)
# aa.append(CooperationMind.objects.filter(belong_to=new_belong, deleted=0).values('id', 'coop_mind_name',
# "client_uuid",
# "data_format"))
# # queryset.save()
#
# # for i in range(len(aa) - 1):
# # if i == 0:
# # bb = str(aa[i])
# # bb = bb + "|" + str(aa[i + 1])
# if len(aa) -1 == 0:
# self.queryset = aa[0]
# elif len(aa) == 0:
# self.queryset = 0
# else:
# for i in range(len(aa) -1):
# if i == 0:
# self.queryset = aa[i]
# self.queryset = self.queryset | aa[i + 1]
# print("=============================")
# print(self.queryset)
# print("=============================")
elif 'share' == page_tag:
# 我的分享
share = CooperationMindShare.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id)