Appearance
/api/v1/comment/article/getComment?aid=文章ID&page=页码&pageSize=内容数量
{ "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" }
,
atUsernames
该接口返回的total为评论和回复总数,而评论和回复是树结构的,因此返回的总数无法用于列表的分页
/api/v1/comment/article/getReply?commentId=评论ID&page=页码&pageSize=内容数量
{ "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" }
无
/api/v1/comment/article/addComment
Authorization': token
"content-type": "application/json",
{ "code": 200, "data": { "comment": { "id": 1, "createdAt": "2022-06-20T13:42:40.625Z", "uid": 1, "content": "测试", "atUsernames": "", "atUserIds": "", "replyUserId": "", "replyUserName": "", "parentId": "", } }, "msg": "ok" }
/api/v1/comment/article/deleteComment/评论或回复ID
{ "code": 200, "data": null, "msg":"ok" }
/api/v1/comment/article/getCommentList?aid=文章ID&page=页码&pageSize=内容数量
{ "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": "", }, "article": { "aid": 2, "uid": 2, "title": "测试1", "cover": "", "content": "", "status": 0, "copyright": true, "createdAt": "2021-07-16T08:49:54Z", "tags": "", "clicks": 10, "partitionId": 1, "author": { "uid": 1, "name": "", "sign": "", "email": "", "phone": "", "avatar": "", "gender": 1, "spaceCover": "", "birthday": "", "createdAt": "", }, }, } ] }, "msg": "ok" }
评论回复相关接口
获取评论回复
请求URL
/api/v1/comment/article/getComment?aid=文章ID&page=页码&pageSize=内容数量
请求方式
返回示例
返回参数说明
评论comment
,
分隔,
分隔 ,与atUsernames
中的顺序一致回复reply
,
分隔,
分隔 ,与atUsernames
中的顺序一致作者信息author
备注
该接口返回的total为评论和回复总数,而评论和回复是树结构的,因此返回的总数无法用于列表的分页
获取回复详情
请求URL
/api/v1/comment/article/getReply?commentId=评论ID&page=页码&pageSize=内容数量
请求方式
返回示例
返回参数说明
回复reply
,
分隔,
分隔 ,与atUsernames
中的顺序一致作者信息author
备注
无
发布评论回复
请求URL
/api/v1/comment/article/addComment
请求方式
请求头
Authorization': token
"content-type": "application/json",
参数
返回示例
返回参数说明
,
分隔,
分隔 ,与atUsernames
中的顺序一致备注
无
删除评论
请求URL
/api/v1/comment/article/deleteComment/评论或回复ID
请求方式
请求头
Authorization': token
"content-type": "application/json",
返回示例
备注
无
获取评论列表
请求URL
/api/v1/comment/article/getCommentList?aid=文章ID&page=页码&pageSize=内容数量
请求方式
返回示例
返回参数说明
评论comment
作者信息author
文章信息
备注
无