文档
测试

获取聊天窗口(getChat)

GET
http://localhost:520/api/chat?type=all

请求参数

参数名
类型
描述
必填
type
string
示例:all
必填

响应参数

参数名
类型
描述
必填
code
int
示例:0
必填
msg
string
示例:sucess
必填
data
object
数据字典
必填
page
int
示例:1
必填
pageSize
int
示例:10
必填
total
int
示例:2
必填
list
array
数据列表
必填
id
int
示例:1
必填
afterMessage
object
示例:null 最后一次发送的消息
必填
fromId
int
示例:1 主动建立窗口用户id
必填
toId
int
示例:3 被动建立窗口用户id
必填
created_at
string
示例:2020-11-20T12:01:51.000Z 最有一次消息接收或发送的时间
必填
messages
array
数据列表
必填
id
int
示例:1
必填
message
string
示例:1111 消息内容
必填
status
boolean
示例:true 消息状态
必填
fromId
int
示例:1 消息发送者用户id
必填
toId
int
示例:3 消息接收者用户id
必填
belong
int
示例:1 消息所属
必填
cId
int
示例:1 聊天窗id
必填
created_at
string
示例:2020-11-20T19:20:12.000Z 发送时间
必填
user
object
数据字典 聊天窗口的用户信息
必填
id
int
示例:3
必填
userName
string
示例:lpl
必填
nickname
string
示例:lck
必填
image
string
示例:http://192.168.160.72:520/static/images/test.png
必填

说明 / 示例

```json { "code": 0, "msg": "sucess", "data": { "page": 1, "pageSize": 10, "total": 2, "list": [ { "id": 1, "afterMessage": null, "fromId": 1, "toId": 3, "created_at": "2020-11-20T12:01:51.000Z", "messages": [ { "id": 1, "message": "1111", "status": true, "fromId": 1, "toId": 3, "belong": 1, "cId": 1, "created_at": "2020-11-20T19:20:12.000Z" }, { "id": 2, "message": "2222", "status": true, "fromId": 1, "toId": 3, "belong": 3, "cId": 1, "created_at": "2020-11-20T19:20:36.000Z" } ], "user": { "id": 3, "userName": "lpl", "nickname": "lck", "image": "http://192.168.160.72:520/static/images/test.png" } }, { "id": 3, "afterMessage": "第五次发消息", "fromId": 1, "toId": 2, "created_at": "2020-11-21T02:57:56.000Z", "messages": [ { "id": 3, "message": "第一次发消息", "status": true, "fromId": 1, "toId": 2, "belong": 1, "cId": 3, "created_at": "2020-11-21T06:31:47.000Z" }, { "id": 6, "message": "第二次发消息", "status": true, "fromId": 1, "toId": 2, "belong": 1, "cId": 3, "created_at": "2020-11-21T06:44:47.000Z" }, { "id": 8, "message": "第三次发消息", "status": false, "fromId": 1, "toId": 2, "belong": 1, "cId": 3, "created_at": "2020-11-21T06:47:04.000Z" }, { "id": 10, "message": "第四次发消息", "status": false, "fromId": 1, "toId": 2, "belong": 1, "cId": 3, "created_at": "2020-11-21T07:48:34.000Z" }, { "id": 18, "message": "第五次发消息", "status": false, "fromId": 2, "toId": 1, "belong": 1, "cId": 3, "created_at": "2020-11-23T00:53:20.000Z" } ], "user": { "id": 2, "userName": "beishi", "nickname": "add", "image": "http://192.168.160.72:520/static/images/test-avatar.png" } } ] } } ```