fix last message bug

This commit is contained in:
baoliang 2021-03-12 16:41:26 +08:00
parent 557f745849
commit b9273e1f5d
2 changed files with 2 additions and 8 deletions

View File

@ -16,15 +16,9 @@ def last_messages(request):
return HttpResponse(status=405)
id = request.user.id
group_id = request.GET.get('group_id')
messages = Message.objects.filter(send_to_id=group_id)[:100]
messages = reversed(Message.objects.filter(send_to_id=group_id).order_by('-added')[:100])
results = []
filter_dict = dict()
for m in messages:
if m.type == 4 or m.type == 1:
task_id = m.task_id
if task_id:
if task_id in filter_dict:
c = filter_dict[task_id]
for o in messages:
result = dict()
t = o.type