return complete group_photo_info for api message_list_api/message_type_list_api

Brightcells vor 9 Jahren
Ursprung
Commit
02373a6dff
1 geänderte Dateien mit 2 neuen Zeilen und 5 gelöschten Zeilen
  1. 2 5
      message/models.py

+ 2 - 5
message/models.py

@@ -61,7 +61,7 @@ class UserMessageInfo(CreateUpdateMixin):
61 61
         try:
62 62
             group_photo = GroupPhotoInfo.objects.get(pk=self.photo_id)
63 63
         except GroupPhotoInfo.DoesNotExist:
64
-            group_photo = None
64
+            group_photo = {}
65 65
         return {
66 66
             'pk': self.pk,
67 67
             'from_uid': self.from_uid,
@@ -69,10 +69,7 @@ class UserMessageInfo(CreateUpdateMixin):
69 69
             'from_avatar': self.from_avatar,
70 70
             'group_id': self.group_id,
71 71
             'photo_id': self.photo_id,
72
-            'photo_url': group_photo and group_photo.photo_url,
73
-            'photo_thumbnail_url': group_photo and group_photo.photo_thumbnail_url,
74
-            'comment_num': group_photo and group_photo.comment_num,
75
-            'thumbup_num': group_photo and group_photo.thumbup_num,
72
+            'group_photo_info': group_photo and group_photo.photo_info(user_id),
76 73
             'msg_title': self.msg_title,
77 74
             'msg_content': self.msg_content,
78 75
             'read': self.read,