curl -X POST "http://localhost:5001/conversations/clearUnread" \
-H "Content-Type: application/json" \
-d '{
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001
}'
const response = await fetch('http://localhost:5001/conversations/clearUnread', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
uid: 'user123',
channel_id: 'group123',
channel_type: 2,
message_seq: 1001
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001
}
response = requests.post('http://localhost:5001/conversations/clearUnread', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/conversations/clearUnread",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
会话管理
清除未读消息
清除会话的未读消息计数
POST
/
conversations
/
clearUnread
curl -X POST "http://localhost:5001/conversations/clearUnread" \
-H "Content-Type: application/json" \
-d '{
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001
}'
const response = await fetch('http://localhost:5001/conversations/clearUnread', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
uid: 'user123',
channel_id: 'group123',
channel_type: 2,
message_seq: 1001
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001
}
response = requests.post('http://localhost:5001/conversations/clearUnread', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/conversations/clearUnread",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
概述
清除指定会话的未读消息计数,将未读数量重置为 0。请求体
用户 ID
频道 ID
频道类型
1- 个人频道2- 群组频道
消息序列号,指定清除到哪条消息为止
curl -X POST "http://localhost:5001/conversations/clearUnread" \
-H "Content-Type: application/json" \
-d '{
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001
}'
const response = await fetch('http://localhost:5001/conversations/clearUnread', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
uid: 'user123',
channel_id: 'group123',
channel_type: 2,
message_seq: 1001
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001
}
response = requests.post('http://localhost:5001/conversations/clearUnread', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"uid": "user123",
"channel_id": "group123",
"channel_type": 2,
"message_seq": 1001,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/conversations/clearUnread",
"application/json",
bytes.NewBuffer(jsonData),
)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("%+v\n", result)
}
{
"status": "ok"
}
响应字段
操作状态,成功时返回
"ok"状态码
| 状态码 | 说明 |
|---|---|
| 200 | 未读消息清除成功 |
| 400 | 请求参数错误 |
| 403 | 没有操作权限 |
| 404 | 会话不存在 |
| 500 | 服务器内部错误 |
⌘I

