fix bug and add chatroom
This commit is contained in:
@@ -83,8 +83,13 @@ def to_chat_room(request):
|
||||
"""
|
||||
聊天室页面
|
||||
"""
|
||||
test_date = request.GET.get('id')
|
||||
name = CooperationMind.objects.get(id=test_date).coop_mind_name
|
||||
room_id = int(test_date) + 10000
|
||||
param = {"page": "chat_room",
|
||||
"username":request.user.username}
|
||||
"username":request.user.username,
|
||||
"name":name,
|
||||
"room_id":room_id}
|
||||
return render(request, "html/wechat_2.html", param)
|
||||
def to_rengwu(request):
|
||||
"""
|
||||
|
||||
+54
-52
@@ -54,59 +54,61 @@ class JsMindView(LoginRequiredJSONMixin, ListAPIView):
|
||||
# 序列化
|
||||
serializer = CooperationMindSerializer(mind[0])
|
||||
return build_response(data=serializer.data)
|
||||
|
||||
# 查询列表
|
||||
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("=============================")
|
||||
elif 'share' == page_tag:
|
||||
# 我的分享
|
||||
share = CooperationMindShare.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id)
|
||||
self.queryset = CooperationMind.objects.annotate(share_col=Exists(share), ).filter(share_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
elif 'star' == page_tag:
|
||||
# 我的收藏
|
||||
star = CooperationMindStar.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id)
|
||||
self.queryset = CooperationMind.objects.annotate(star_col=Exists(star), ).filter(star_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
elif 'recycle' == page_tag:
|
||||
# 回收站
|
||||
self.queryset = CooperationMind.objects.filter(creator_user_id=user.id, deleted=1).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
if user.type_t_or_s == 1:
|
||||
self.queryset = CooperationMind.objects.all()
|
||||
else:
|
||||
# 不返回数据
|
||||
self.queryset = CooperationMind.objects.filter(creator_user_id=-100).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
# 查询列表
|
||||
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("=============================")
|
||||
elif 'share' == page_tag:
|
||||
# 我的分享
|
||||
share = CooperationMindShare.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id)
|
||||
self.queryset = CooperationMind.objects.annotate(share_col=Exists(share), ).filter(share_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
elif 'star' == page_tag:
|
||||
# 我的收藏
|
||||
star = CooperationMindStar.objects.filter(coop_mind_id=OuterRef('id'), operator_user_id=user.id)
|
||||
self.queryset = CooperationMind.objects.annotate(star_col=Exists(star), ).filter(star_col=1, deleted=0).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
elif 'recycle' == page_tag:
|
||||
# 回收站
|
||||
self.queryset = CooperationMind.objects.filter(creator_user_id=user.id, deleted=1).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
else:
|
||||
# 不返回数据
|
||||
self.queryset = CooperationMind.objects.filter(creator_user_id=-100).values('id', 'coop_mind_name', "client_uuid", "data_format")
|
||||
return self.list(request, *args, **kwargs)
|
||||
|
||||
def post(self, request):
|
||||
|
||||
Reference in New Issue
Block a user