新增可信发布者
1. 接口定位
- 接口名称: 新增可信发布者
- 所属域: admin/moments
- 业务目标: 将指定用户加入“动态可信发布者”名单,加入后其新发布动态可直通审核通过
2. 请求定义
- Method:
POST - Path:
/adminx/moments/trusted_publisher/add - Content-Type: 推荐
application/json - operationID: 必填,请通过 Header
operationID传入 - 鉴权: 需要 Header
token,且必须是管理员 token - 幂等性: 幂等(重复添加会 upsert 覆盖 reason/operator)
3. 请求参数
Header 参数
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| operationID | 是 | string | 链路追踪 ID |
| token | 是 | string | 管理员 token |
Body 参数
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| userIDs | 是 | array<string> | 需要加入可信发布者名单的用户 ID 列表 |
| reason | 否 | string | 加入原因,写入可信发布者记录 |
字段约束
userIDs不能为空数组。userIDs不能包含重复值。userIDs中每个用户都必须真实存在。
4. 响应结构
通用响应包裹
| 字段 | 类型 | 说明 |
|---|---|---|
| errCode | int | 错误码,0 表示成功 |
| errMsg | string | 错误简述 |
| errDlt | string | 错误详情 |
| data | object | 业务数据 |
data 字段
- 成功时返回空对象。
5. 业务规则
- 仅管理员可调用。
- 写入为 upsert 语义;已在名单内的用户会更新
reason/operator/updateTime。 operatorUserID记录为当前管理员 userID。
6. 错误码与失败场景
| 错误码 | 场景 | 典型报错 |
|---|---|---|
| 1001 | userIDs 为空 | userIDs is required |
| 1001 | userIDs 重复 | userIDs has duplicate |
| 1004 | 存在用户不存在 | user id not found |
| - | 写入失败 | 由数据库层返回原始错误 |
7. 示例
fetch 请求示例
javascript
fetch("http://localhost:10011/adminx/moments/trusted_publisher/add", {
method: "POST",
headers: {
operationID: "adminx-moments-trusted-add-001",
token: "eyJhbGciOi...",
"Content-Type": "application/json",
},
body: JSON.stringify({
userIDs: ["9000000001", "9000000002"],
reason: "official account",
}),
})
.then((res) => res.json())
.then((data) => console.log(data));成功响应示例
json
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {}
}8. 变更记录
- 2026-06-01: 首版发布,新增动态可信发布者管理接口。