You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.8 KiB
78 lines
2.8 KiB
meta {
|
|
name: 图谱整体保存
|
|
type: http
|
|
seq: 2
|
|
tags: [
|
|
generated
|
|
]
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/customer/contact/graph/save
|
|
body: formUrlEncoded
|
|
auth: inherit
|
|
}
|
|
|
|
body:form-urlencoded {
|
|
customerId: 753314901191032832
|
|
version: 1
|
|
nodes[0].contactId: 753314905687326720
|
|
nodes[0].level: 10
|
|
nodes[1].contactId: 753314905817350144
|
|
nodes[1].level: 6
|
|
nodes[2].contactId: 753314905951567872
|
|
nodes[2].level: 3
|
|
nodes[3].contactId: 753314906073202688
|
|
edges[0].parentId: 753314905687326720
|
|
edges[0].childId: 753314905817350144
|
|
}
|
|
|
|
docs {
|
|
# 图谱整体保存
|
|
`POST /api/customer/contact/graph/save`(本行兼作对账钥匙,勿手改)
|
|
全量快照单事务:版本 CAS(冲突 67018)→ 边校验(67019/67020)→ level 批写 + 边全量替换;返回新版本号。nodes 携带每个联系人的等级终态(null=撤级,撤级须无任何边),edges 为最终边集(空=清空全部边);表单绑定嵌套行走 indexed(rows[i].xxx),D4:编辑态变更驻前端 pending,save 单事务全量落库。
|
|
|
|
## 请求参数
|
|
|
|
| 参数 | 类型 | 必填 | 默认 | 说明 |
|
|
| --- | --- | --- | --- | --- |
|
|
| customerId | string | 是 | - | 客户 id |
|
|
| version | number | 是 | - | 图谱版本号(读端点返回值原样带回;不符 → 67018 冲突) |
|
|
| nodes[i].contactId | string | 是 | - | 联系人 id(必须属于 customerId 客户) |
|
|
| nodes[i].level | number | 否 | - | 等级 1–10;null=撤级(撤级须无任何边) |
|
|
| edges[i].parentId | string | 是 | - | 上级联系人 id(level 高者) |
|
|
| edges[i].childId | string | 是 | - | 下级联系人 id(level 低者) |
|
|
|
|
## 请求示例
|
|
|
|
请求头:Authorization: Bearer {{token}}
|
|
Content-Type: application/x-www-form-urlencoded
|
|
|
|
POST /api/customer/contact/graph/save
|
|
customerId=753314901191032832&version=1&nodes[0].contactId=753314905687326720&nodes[0].level=10&nodes[1].contactId=753314905817350144&nodes[1].level=6&nodes[2].contactId=753314905951567872&nodes[2].level=3&nodes[3].contactId=753314906073202688&edges[0].parentId=753314905687326720&edges[0].childId=753314905817350144
|
|
|
|
## 响应 data 结构
|
|
|
|
| 字段 | 类型 | 说明 |
|
|
| --- | --- | --- |
|
|
| (data 本体) | number | 新版本号(保存成功后的图谱版本) |
|
|
|
|
## 错误码
|
|
|
|
- 67002 客户不存在或已被删除(无权访问同码)
|
|
- 67018 图谱版本冲突:save 乐观锁比对不符,提示刷新后重试
|
|
- 67019 图谱边非法:自连/重复/等级倒挂或越界/未定级端点/端点越界
|
|
- 67020 图谱结构校验失败:单父违反/等级调整约束
|
|
|
|
## 响应示例
|
|
|
|
// 示例数据(E2E 实测真值),字段结构以上表为准
|
|
```json
|
|
{
|
|
"code": 0,
|
|
"success": true,
|
|
"message": "success",
|
|
"data": 2
|
|
}
|
|
```
|
|
}
|
|
|