Skip to content

评论回复相关接口

获取评论回复

请求URL

  • /api/v1/comment/video/getComment?vid=视频ID&page=页码&pageSize=内容数量

请求方式

  • GET

返回示例

json
{
  "code": 200,
  "data": {
    "total": 1,
    "comments": [
      {
        "id": 1,
        "createdAt": "2022-06-20T13:42:40.625Z",
        "uid": 1,
        "content": "测试",
        "atUsernames": "",
        "atUserIds": "",
        "parentId": "",
        "replyCount": 2,
        "author": {
          "uid": 1,
          "name": "",
          "sign": "",
          "email": "",
          "phone": "",
          "avatar": "",
          "gender": 1,
          "spaceCover": "",
          "birthday": "",
          "createdAt": "",
        },
        "reply": [
          {
            "id": 1,
            "createdAt": "2022-06-20T13:42:40.625Z",
            "uid": 1,
            "content": "测试",
            "atUsernames": "",
            "atUserIds": "",
            "replyUserId": "",
            "replyUserName": "",
            "parentId": "",
            "author": {
              "uid": 1,
              "name": "",
              "sign": "",
              "email": "",
              "phone": "",
              "avatar": "",
              "gender": 1,
              "spaceCover": "",
              "birthday": "",
              "createdAt": "",
             },
          }
        ]
      }
    ]
  },
  "msg": "ok"
}

返回参数说明

参数名类型说明
totalint数量
commentsobject评论回复数组
评论comment
参数名类型说明
idint用户ID
createdAtstring发布时间
uidint用户ID
contentstring评论内容
atUsernamesstring@用户的用户名,使用,分隔
atUserIdsstring@用户的ID,使用,分隔 ,与atUsernames中的顺序一致
parentIdint所属评论ID
replyCountint回复数量
authorobject作者信息
replyobject回复数组
回复reply
参数名类型说明
idint用户ID
createdAtstring发布时间
uidint用户ID
contentstring评论内容
atUsernamesstring@用户的用户名,使用,分隔
atUserIdsstring@用户的ID,使用,分隔 ,与atUsernames中的顺序一致
replyUserNamestring回复用户的用户名
replyUserIdstring回复用户的ID
parentIdint所属评论ID
authorobject作者信息
作者信息author
参数名类型说明
uidint用户ID
namestring用户名
signstring个性签名
emailstring邮箱
phonestring手机号
avatarstring头像
genderint用户性别,0:未知;1:男;2:女
spacecoverstring用户空间封面图
birthdaytime生日
createdAttime注册时间

备注

该接口返回的total为评论和回复总数,而评论和回复是树结构的,因此返回的总数无法用于列表的分页

获取回复详情

请求URL
  • /api/v1/comment/video/getReply?commentId=评论ID&page=页码&pageSize=内容数量
请求方式
  • GET
返回示例
json
{
  "code": 200,
  "data": {
    "replies": [
      {
        "id": 1,
        "createdAt": "2022-06-20T13:42:40.625Z",
        "uid": 1,
        "content": "测试",
        "atUsernames": "",
        "atUserIds": "",
        "replyUserId": "",
        "replyUserName": "",
        "parentId": "",
        "author": {
          "uid": 1,
          "name": "",
          "sign": "",
          "email": "",
          "phone": "",
          "avatar": "",
          "gender": 1,
          "spaceCover": "",
          "birthday": "",
          "createdAt": "",
        },
      }
    ]
  },
  "msg": "ok"
}

返回参数说明

参数名类型说明
repliesobject回复数组
回复reply
参数名类型说明
idint用户ID
createdAtstring发布时间
uidint用户ID
contentstring评论内容
atUsernamesstring@用户的用户名,使用,分隔
atUserIdsstring@用户的ID,使用,分隔 ,与atUsernames中的顺序一致
replyUserNamestring回复用户的用户名
replyUserIdstring回复用户的ID
parentIdint所属评论ID
authorobject作者信息
作者信息author
参数名类型说明
uidint用户ID
namestring用户名
signstring个性签名
emailstring邮箱
phonestring手机号
avatarstring头像
genderint用户性别,0:未知;1:男;2:女
spacecoverstring用户空间封面图
birthdaytime生日
createdAttime注册时间

备注

发布评论回复

请求URL

  • /api/v1/comment/video/addComment

请求方式

  • POST

请求头

  • Authorization': token
  • "content-type": "application/json",

参数

参数名必选类型说明
cidint视频ID
contentstring评论内容
at[]string@的用户名数组
parentIDint所属评论ID
replyUserIDint回复用户的ID
replyUserNamestring回复用户的用户名
replyContentstring回复的评论或回复的内容,用于发送通知

返回示例

json
{
  "code": 200,
  "data": {
    "comment": {
      "id": 1,
      "createdAt": "2022-06-20T13:42:40.625Z",
      "uid": 1,
      "content": "测试",
      "atUsernames": "",
      "atUserIds": "",
      "replyUserId": "",
      "replyUserName": "",
      "parentId": "",
    }
  },
  "msg": "ok"
}

返回参数说明

参数名类型说明
idint用户ID
createdAtstring发布时间
uidint用户ID
contentstring评论内容
atUsernamesstring@用户的用户名,使用,分隔
atUserIdsstring@用户的ID,使用,分隔 ,与atUsernames中的顺序一致
replyUserNamestring回复用户的用户名
replyUserIdstring回复用户的ID
parentIdint所属评论ID
authorobject作者信息

备注

删除评论

请求URL

  • /api/v1/comment/video/deleteComment/评论或回复ID

请求方式

  • DELETE

请求头

  • Authorization': token
  • "content-type": "application/json",

返回示例

json
{
  "code": 200,
  "data": null,
  "msg":"ok"
}

备注

获取评论列表

请求URL

  • /api/v1/comment/video/getCommentList?vid=视频ID&page=页码&pageSize=内容数量

请求方式

  • GET

返回示例

json
{
  "code": 200,
  "data": {
    "total": 1,
    "comments": [
      {
        "id": 1,
        "cid": 1,
        "sid": 1,
        "uid": 1,
        "createdAt": "2022-06-20T13:42:40.625Z",
        "content": "测试",
        "targetReplyContent": "",
        "rootContent": "",    
        "commentId": 1,
        "parentId": "",
        "author": {
          "uid": 1,
          "name": "",
          "sign": "",
          "email": "",
          "phone": "",
          "avatar": "",
          "gender": 1,
          "spaceCover": "",
          "birthday": "",
          "createdAt": "",
        },
        "target": {
          "uid": 2,
          "name": "",
          "sign": "",
          "email": "",
          "phone": "",
          "avatar": "",
          "gender": 1,
          "spaceCover": "",
          "birthday": "",
          "createdAt": "",
        },
        "video": {
          "vid": 1,
          "uid": 1,
          "title": "标题",
          "cover": "封面url",
          "desc": "视频简介",
          "createdAt": "",
          "copyright": true,
          "tags": "",
          "duration": 10,
          "clicks": 10,
          "partitionId": 1,
          "author": {
            "uid": 1,
            "name": "",
            "sign": "",
            "email": "",
            "phone": "",
            "avatar": "",
            "gender": 1,
            "spaceCover": "",
            "birthday": "",
            "createdAt": "",
          },
          "resources": [
            {
              "id": 1,
              "createdAt": "",
              "vid": 1,
              "title": "",
              "duration": 10,
              "status": 0
            }
          ]
        }
      }
    ]
  },
  "msg": "ok"
}

返回参数说明

参数名类型说明
totalint数量
commentsobject评论回复数组
评论comment
参数名类型说明
idintid
cidint视频ID
sidint发送用户ID
uidint用户ID
createdAtstring发布时间
contentstring评论或回复内容
targetReplyContentstring回复目标内容
rootContentstring根评论内容
commentIdint评论ID
authorobject作者信息
targetobject回复目标用户信息
videoobject视频信息
作者信息author
参数名类型说明
uidint用户ID
namestring用户名
signstring个性签名
emailstring邮箱
phonestring手机号
avatarstring头像
genderint用户性别,0:未知;1:男;2:女
spacecoverstring用户空间封面图
birthdaytime生日
createdAttime注册时间
视频信息video
参数名类型说明
vidint视频ID
uidint作者ID
titlestring标题
coverstring封面URL
descstring视频简介
createdAtstring上传时间
copyrightbool是否为原创视频
tagsstring视频标签
durationfloat视频时长
clicksint视频点击量
partitionIdint分区ID
authorobject作者信息
resourcearray视频资源,多个代表多个分集
视频资源resource
参数名类型说明
idint分集ID
createdAtstring上传时间
vidint视频ID
titlestring标题
durationfloat视频时长
statusint审核状态

备注

根据 MIT 许可证发布