未读消息

优质
小牛编辑
128浏览
2023-12-01
  • 该未读消息接口记录不含在通知内的消息,如当前用户收到的评论、点赞和未处理的审核等,调用相应的列表和操作接口,讲自动清零
GET /user/unread-count

Response

Status: 200 OK
{
  "counts": {
    "user_id": 1,
    "unread_comments_count": 0,
    "unread_likes_count": 0,
    "created_at": "2017-10-19 15:07:46",
    "updated_at": "2017-10-19 15:07:46"
  },
  "atme": {
    "users": ["root"],          // At 我的用户预览列表
    "latest_at": "2018-08-13T08:06:54Z" // 最近 at 我的时间
  },
  "comments": [
    {
      "user_id": 2,
      "id": 14,
      "time": "2017-09-15 07:37:13",
      "user": {
        "id": 2,
        "name": "root1",
        "bio": null,
        "sex": 0,
        "location": null,
        "created_at": "2017-07-31 03:16:19",
        "updated_at": "2017-07-31 03:16:19",
        "avatar": null,
        "bg": null,
        "verified": null,
        "extra": {
          "user_id": 2,
          "likes_count": 2,
          "comments_count": 9,
          "followers_count": 0,
          "followings_count": 0,
          "updated_at": "2017-08-21 08:39:43",
          "feeds_count": 0,
          "questions_count": 1,
          "answers_count": 19,
          "checkin_count": 0,
          "last_checkin_count": 0
        }
      }
    }
  ],
  "likes": [],
  "pinneds": {
    "news": {
      "time": null,
      "count": 0
    },
    "feeds": {
      "time": "2017-09-15 10:04:19",
      "count": 1
    }
  },
  "system": {
    ... // 参考系统消息列表接口
  }
}

响应

名称类型描述
countsObject用户未读消息统计,未产生任何记录时为null
counts.unread_comments_countint未读评论数
counts.unread_likes_countint未读点赞数
commentsarray最近几条评论信息
comments.timetime评论时间
comments.userarray评论者信息
likesarray最近几条点赞信息,数据格式同评论
pinnedsarray未处理审核统计, 目前可能有 news - 未处理的资讯评论置顶, feeds - 未处理的动态评论置顶
pinneds.*.timetime/null最新一条待审核记录的时间
pinneds.*.countint未操作审核数
systemObject最新的系统消息