Appearance
POST
/chatx/moments/comment/list
application/json
operationID
token
pagination
0..50
0
userID
cursor
limit > 0
limit
pageNumber=1
showNumber=20
a2r.Call
postID
pagination.pageNumber
pagination.showNumber
array<object>
createTime DESC, commentID DESC
nextCursor
commentID
createTime ASC
header must have operationID
token is empty
postID is empty
limit < 0
limit is invalid
limit > 50
limit exceeds max
pagination.pageNumber < 1
pageNumber is invalid
pagination.showNumber < 1
showNumber is invalid
fetch("http://localhost:10010/chatx/moments/comment/list", { method: "POST", headers: { operationID: "moments-comment-list-001", token: "user-token", "Content-Type": "application/json", }, body: JSON.stringify({ postID: "p_10001", cursor: "", limit: 20, }), }) .then((res) => res.json()) .then((data) => console.log(data));
{ "postID": "p_10001", "cursor": "", "limit": 20 }
{ "errCode": 0, "errMsg": "", "errDlt": "", "data": { "total": 3, "comments": [ { "commentID": "c_3003", "postID": "p_10001", "userID": "u_1002", "replyToCommentID": "", "content": "收到,安排。", "createTime": 1774920500000, "commenter": { "userID": "u_1002", "nickname": "Bob", "faceURL": "https://cdn.example.com/avatar/b.png" } } ], "nextCursor": "c_3003" } }
{ "errCode": 1001, "errMsg": "ArgsError", "errDlt": "limit exceeds max" }
total
comments
获取评论列表
1. 接口定位
2. 请求定义
POST/chatx/moments/comment/listapplication/jsonoperationID传入token传入有效登录令牌3. 请求参数
Header 参数
Body 参数
pagination时需大于等于 1pagination时需大于等于 10..50范围内,0在游标模式下会按默认值处理字段说明
token,但这个接口的 API 层不会把当前用户userID注入请求体。cursor非空,或limit > 0时,当前实现进入游标模式。cursor为空且limit未传或为0时,当前实现进入页码模式。pagination为空,服务端 默认使用pageNumber=1、showNumber=20。a2r.Call调用链,postID、limit、pagination.pageNumber、pagination.showNumber的校验会在进入服务端处理前执行。4. 响应结构
通用响应包裹
0表示成功data 字段
array<object>comment 对象
commenter 对象
5. 业务规则
token,但当前接口不会把 token 中的用户 ID 写进请求。createTime DESC, commentID DESC返回;当本页条数等于实际查询limit时,nextCursor取最后一条评论的commentID。createTime ASC返回。cursor对应评论查不到,当前实现不会追加游标过滤,效果等同从最新评论重新开始拉取。6. 错误码与失败场景
operationIDheader must have operationIDtokentoken is emptypostID为空postID is emptylimit < 0limit is invalidlimit > 50limit exceeds maxpagination.pageNumber < 1pageNumber is invalidpagination.showNumber < 1showNumber is invalid7. 示例
fetch 请求示例
请求示例(JSON)
成功响应示例
失败响应示例
8. 时序流程
operationID和token。postID、limit、pagination的格式约束。total、comments和nextCursor。9. 变更记录