curl -X POST "http://localhost:5001/channel/subscriber_remove" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"subscribers": ["user4", "user5"],
"temp_subscriber": 0
}'
const response = await fetch('http://localhost:5001/channel/subscriber_remove', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
subscribers: ['user4', 'user5'],
temp_subscriber: 0
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"subscribers": ["user4", "user5"],
"temp_subscriber": 0
}
response = requests.post('http://localhost:5001/channel/subscriber_remove', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"subscribers": []string{"user4", "user5"},
"temp_subscriber": 0,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/subscriber_remove",
"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
/
channel
/
subscriber_remove
curl -X POST "http://localhost:5001/channel/subscriber_remove" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"subscribers": ["user4", "user5"],
"temp_subscriber": 0
}'
const response = await fetch('http://localhost:5001/channel/subscriber_remove', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
subscribers: ['user4', 'user5'],
temp_subscriber: 0
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"subscribers": ["user4", "user5"],
"temp_subscriber": 0
}
response = requests.post('http://localhost:5001/channel/subscriber_remove', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"subscribers": []string{"user4", "user5"},
"temp_subscriber": 0,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/subscriber_remove",
"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"
}
概述
从频道移除订阅者(成员),支持批量移除操作。请求体
频道 ID
频道类型
1- 个人频道2- 群组频道
是否为临时订阅者
0- 永久订阅者1- 临时订阅者
curl -X POST "http://localhost:5001/channel/subscriber_remove" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "group123",
"channel_type": 2,
"subscribers": ["user4", "user5"],
"temp_subscriber": 0
}'
const response = await fetch('http://localhost:5001/channel/subscriber_remove', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: 'group123',
channel_type: 2,
subscribers: ['user4', 'user5'],
temp_subscriber: 0
})
});
const data = await response.json();
console.log(data);
import requests
data = {
"channel_id": "group123",
"channel_type": 2,
"subscribers": ["user4", "user5"],
"temp_subscriber": 0
}
response = requests.post('http://localhost:5001/channel/subscriber_remove', json=data)
result = response.json()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
data := map[string]interface{}{
"channel_id": "group123",
"channel_type": 2,
"subscribers": []string{"user4", "user5"},
"temp_subscriber": 0,
}
jsonData, _ := json.Marshal(data)
resp, err := http.Post(
"http://localhost:5001/channel/subscriber_remove",
"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 | 服务器内部错误 |
参数说明
临时订阅者 (temp_subscriber)
| 值 | 类型 | 说明 | 影响 |
|---|---|---|---|
| 0 | 永久订阅者 | 移除正式成员 | 完全移除成员关系 |
| 1 | 临时订阅者 | 移除临时成员 | 移除临时访问权限 |
使用场景
群组管理
- 踢出成员:群主或管理员移除违规成员
- 成员退群:用户主动退出群组
- 批量清理:清理不活跃或无效的成员
⌘I

