对接文档重构:两种发货对接方式分开展示
- 左侧目录按分组展示:基础接口 / 发货链接模式 / 自建发货页模式 / 回调 / 附录 - 概述页发货对接方式对比表强化(适用场景/接口顺序/建议) - 创建订单响应示例 data 统一为约定字段,补充 201/200 状态说明 - 对外响应字段 upstream_order 更名为 delivery(result_data 存储键兼容旧数据)
This commit is contained in:
@@ -19,15 +19,18 @@ const baseUrl =
|
||||
|
||||
const deliveryModes = [
|
||||
{
|
||||
mode: 'Web 发货页',
|
||||
scene: '商户想要“只返回一个链接”,让用户直接打开平台页面填写 UID',
|
||||
mode: '发货链接模式',
|
||||
scene: '实现最简:下单后拿一个签名链接,直接跳转平台发货页,由买家在页面上绑定账号并提交',
|
||||
interfaces: '/api/client/v1/orders/{order_no}/delivery-link',
|
||||
steps: '下单 → 获取发货链接 → 链接给买家 → 平台页完成发货',
|
||||
recommend: '商户无自建发货页、想最快上线时使用',
|
||||
},
|
||||
{
|
||||
mode: '自建发货页',
|
||||
scene: '商户自己有前端页面,想在自己的系统里完成发货流程',
|
||||
interfaces:
|
||||
'/api/client/v1/orders/{order_no}/delivery\n/api/client/v1/orders/{order_no}/delivery/bind\n/api/client/v1/orders/{order_no}/delivery/submit',
|
||||
mode: '自建发货页模式',
|
||||
scene: '商户自己有前端页面,把发货流程嵌在自己的系统里(可预填下单时透传的账号/区服)',
|
||||
interfaces: '/api/client/v1/orders/{order_no}/delivery\n/api/client/v1/orders/{order_no}/delivery/bind\n/api/client/v1/orders/{order_no}/delivery/submit',
|
||||
steps: '下单 → 查询发货数据 → 发起绑定 → 提交发货',
|
||||
recommend: '商户需要自定义发货交互(展示区服、预填账号)时使用',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -48,6 +51,16 @@ interface TocGroup {
|
||||
}
|
||||
|
||||
function buildToc(): TocGroup[] {
|
||||
const tocItems = (eps: typeof endpoints) =>
|
||||
eps.map((ep) => ({
|
||||
id: `ep-${ep.key}`,
|
||||
label: ep.title,
|
||||
children: endpointSections.map((s) => ({
|
||||
id: `ep-${ep.key}-${s.id}`,
|
||||
label: s.label,
|
||||
level: 3 as const,
|
||||
})),
|
||||
}))
|
||||
return [
|
||||
{
|
||||
title: '开始',
|
||||
@@ -57,16 +70,16 @@ function buildToc(): TocGroup[] {
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '接口',
|
||||
items: endpoints.map((ep) => ({
|
||||
id: `ep-${ep.key}`,
|
||||
label: ep.title,
|
||||
children: endpointSections.map((s) => ({
|
||||
id: `ep-${ep.key}-${s.id}`,
|
||||
label: s.label,
|
||||
level: 3 as const,
|
||||
})),
|
||||
})),
|
||||
title: '基础接口',
|
||||
items: tocItems(endpoints.filter((ep) => ep.group === 'basic')),
|
||||
},
|
||||
{
|
||||
title: '发货链接模式',
|
||||
items: tocItems(endpoints.filter((ep) => ep.group === 'delivery-link')),
|
||||
},
|
||||
{
|
||||
title: '自建发货页模式',
|
||||
items: tocItems(endpoints.filter((ep) => ep.group === 'delivery-self')),
|
||||
},
|
||||
{
|
||||
title: '回调',
|
||||
@@ -321,12 +334,12 @@ function OverviewSection() {
|
||||
<li>在「开放 API / API 密钥」创建凭证,获得 <Text code>AppKey</Text> 与 <Text code>AppSecret</Text>。</li>
|
||||
<li>每次请求携带 <Text code>X-App-Key / X-Timestamp / X-Nonce / X-Sign</Text> 四个鉴权头。</li>
|
||||
<li>调用「商品列表」拿到可售 <Text code>sku</Text>,调用「下单」创建订单并扣款。</li>
|
||||
<li>拿到 <Text code>order_no</Text> 后,可选择返回发货链接,或者用结构化发货接口完成自建页面流程。</li>
|
||||
<li>拿到 <Text code>order_no</Text> 后,按「发货对接方式」二选一:发货链接模式(返回链接即可)或自建发货页模式(结构化接口)。</li>
|
||||
<li>在「回调」页配置回调地址并订阅事件,订单状态变化会实时推送,见「回调通知」。</li>
|
||||
</ol>
|
||||
}
|
||||
/>
|
||||
<Card className="api-docs__card" size="small" title="发货链路概览">
|
||||
<Card className="api-docs__card" size="small" title="发货对接方式(二选一,先选好再看对应接口)">
|
||||
<Table
|
||||
className="api-docs__table"
|
||||
size="small"
|
||||
@@ -334,13 +347,20 @@ function OverviewSection() {
|
||||
rowKey="mode"
|
||||
dataSource={deliveryModes}
|
||||
columns={[
|
||||
{ title: '模式', dataIndex: 'mode', width: 140 },
|
||||
{ title: '方式', dataIndex: 'mode', width: 130 },
|
||||
{ title: '适用场景', dataIndex: 'scene' },
|
||||
{
|
||||
title: '接口顺序',
|
||||
dataIndex: 'steps',
|
||||
width: 250,
|
||||
render: (v: string) => <pre className="api-docs__pre">{v}</pre>,
|
||||
},
|
||||
{
|
||||
title: '相关接口',
|
||||
dataIndex: 'interfaces',
|
||||
render: (v: string) => <pre className="api-docs__pre">{v}</pre>,
|
||||
},
|
||||
{ title: '建议', dataIndex: 'recommend', width: 170 },
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user