コード例 #1
0
 def get(self, request):
     notification_article_count = Notification.objects(
         media_id=self.media_id,
         status=STATUS_UNREAD,
         type__in=NOTIFICATION_ARTICLE_TYPES).count()
     notification_media_count = Notification.objects(
         media_id=self.media_id,
         status=STATUS_UNREAD,
         type__in=NOTIFICATION_MEDIA_TYPES).count()
     notification_admin_count = Notification.objects(
         media_id=self.media_id,
         status=STATUS_UNREAD,
         type__in=NOTIFICATION_ADMIN_TYPES).count()
     return {
         'article_review_count': notification_article_count,
         'system_notification_count': notification_media_count,
         'admin_message_count': notification_admin_count,
     }
コード例 #2
0
 def get(self, request):
     notification_count = Notification.objects(
         media_id=self.media_id, status=STATUS_UNREAD).count()
     comment_media = CommentMediaInfo.objects(
         media_id=str(self.media_account.id)).first()
     if comment_media:
         comment_count = comment_media.unread_comment_count
     else:
         comment_count = 0
     return {
         'count': notification_count + comment_count,
         'unread_comment_count': comment_count
     }