帖子 置顶

优质
小牛编辑
130浏览
2023-12-01

帖子申请置顶列表

GET /pinned/posts

参数说明

名称类型说明
limitinteger默认 15 ,数据返回条数 默认为15
afterinteger默认 0 ,数据偏移量,传递之前通过接口获取的总数。
groupinteger默认 全部,某个圈子置顶帖子需传圈子id

响应

status 200
[
  {
    "id": 3,
    "channel": "post",
    "raw": 0,
    "target": 2,
    "user_id": 1,
    "target_user": 1,
    "amount": 200,
    "day": 1,
    "expires_at": null,
    "status": 0,
    "created_at": "2017-11-30 10:42:14",
    "updated_at": "2017-11-30 10:42:14",
    "user": {
      "id": 1,
      "name": "root",
      "bio": null,
      "sex": 0,
      "location": null,
      "created_at": "2017-11-09 08:17:26",
      "updated_at": "2017-11-09 08:17:26",
      "avatar": "http://127.0.0.1/duibi/thinksns-plus/public/api/v2/users/1/avatar",
      "bg": null,
      "verified": null,
      "extra": {
        "user_id": 1,
        "likes_count": 4,
        "comments_count": 4,
        "followers_count": 0,
        "followings_count": 0,
        "updated_at": "2017-11-29 06:50:57",
        "feeds_count": 9,
        "questions_count": 0,
        "answers_count": 0,
        "checkin_count": 0,
        "last_checkin_count": 0,
        "live_zans_count": 0,
        "live_zans_remain": 0,
        "live_time": 0
      }
    },
    "post": {
      "id": 2,
      "group_id": 1,
      "user_id": 1,
      "title": "123123",
      "body": "士大夫",
      "summary": "123123",
      "likes_count": 4,
      "comments_count": 1,
      "views_count": 0,
      "created_at": "2017-11-27 11:20:07",
      "updated_at": "2017-11-29 06:50:57"
    }
  }
]

返回参数说明

名称类型说明
idint数据id
channelstring置顶类型 有comment 评论置顶和post帖子置顶两种,该接口中始终为post
rawintchannelcomment时为帖子id,该接口中始终为0
targetint帖子id
user_idint申请人id
target_userint申请对方id,该接口中始终等于当前认证用户id
amountint置顶金额,分单位
dayint置顶天数
expires_atdate置顶过期时间 (被拒绝时为拒绝处理的操作时间)
statusint处理状态 0-待审核 1-已通过 2-已拒绝
created_atdate数据创建时间,可视为用户申请时间
userarray申请者用户信息,参考对应用户数据
postarray申请的帖子信息,参考帖子数据

申请帖子置顶

POST /pinned/posts/:post

参数说明

名称类型说明
amountinteger必须 置顶金额
dayinteger必须 置顶天数

响应

status 201

通过帖子置顶

PATCH /pinned/posts/:post/accept

响应

status 201

拒绝帖子置顶

PATCH /pinned/posts/:post/reject

响应

status 201

帖子评论申请置顶列表

GET /pinned/comments

参数说明

名称类型说明
limitinteger默认 15 ,数据返回条数 默认为15
afterinteger默认 0 ,数据偏移量,传递之前通过接口获取的总数。
postinteger默认 全部,某个帖子下的评论置顶需传帖子id

响应

status 200
[
  {
    "id": 4,
    "channel": "comment",
    "raw": 1,
    "target": 4,
    "user_id": 1,
    "target_user": 1,
    "amount": 200,
    "day": 1,
    "expires_at": "2017-12-02 01:57:30",
    "status": 1,
    "created_at": "2017-12-01 01:56:35",
    "updated_at": "2017-12-01 01:57:30",
    "comment": {
      "id": 4,
      "user_id": 1,
      "target_user": 1,
      "reply_user": 0,
      "body": "<http://www.baidu.com>",
      "commentable_id": 1,
      "commentable_type": "group-posts",
      "created_at": "2017-11-27 03:31:38",
      "updated_at": "2017-11-27 03:31:38"
    },
    "user": {
      "id": 1,
      "name": "root",
      "bio": null,
      "sex": 0,
      "location": null,
      "created_at": "2017-11-09 08:17:26",
      "updated_at": "2017-11-09 08:17:26",
      "avatar": "http://127.0.0.1/duibi/thinksns-plus/public/api/v2/users/1/avatar",
      "bg": null,
      "verified": null,
      "extra": {
        "user_id": 1,
        "likes_count": 4,
        "comments_count": 4,
        "followers_count": 0,
        "followings_count": 0,
        "updated_at": "2017-11-29 06:50:57",
        "feeds_count": 9,
        "questions_count": 0,
        "answers_count": 0,
        "checkin_count": 0,
        "last_checkin_count": 0,
        "live_zans_count": 0,
        "live_zans_remain": 0,
        "live_time": 0
      }
    },
    "post": {
      "id": 1,
      "group_id": 1,
      "user_id": 1,
      "title": "123123",
      "body": "士大夫",
      "summary": "",
      "likes_count": 4,
      "comments_count": 1,
      "views_count": 0,
      "created_at": "2017-11-27 11:20:07",
      "updated_at": "2017-11-29 06:50:57"
    }
  }
]

返回参数说明

名称类型说明
idint数据id
channelstring置顶类型 有comment 评论置顶和post帖子置顶两种,该接口中始终为comment
rawintchannelcomment时为帖子id,该接口中始终为对应的帖子id
targetint帖子id
user_idint申请人id
target_userint申请对方id,该接口中始终等于当前认证用户id
amountint置顶金额,分单位
dayint置顶天数
expires_atdate置顶过期时间 (被拒绝时为拒绝处理的操作时间)
statusint处理状态 0-待审核 1-已通过 2-已拒绝
created_atdate数据创建时间,可视为用户申请时间
userarray申请者用户信息,参考对应用户数据
postarray对应的帖子信息,参考帖子数据
commentarray申请置顶的评论信息,参考评论数据

帖子评论申请置顶

POST /pinned/comments/:comment

参数说明

名称类型说明
amountinteger必须 置顶金额
dayinteger必须 置顶天数

响应

status 201

通过帖子评论申请置顶

PATCH /pinned/comments/:comment/accept

响应

status 201

拒绝帖子评论申请置顶

PATCH /pinned/comments/:comment/reject

响应

status 201

圈主和管理员置顶帖子

POST /pinned/posts/:post/create

参数说明

名称类型说明
dayinteger必须 置顶天数

响应

status 201

圈主和管理员取消置顶帖子

PATCH /pinned/posts/:post/cancel

响应

status 201