From 6404b106261dd0e428b3cd8a4cf3f3383e66edb3 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Tue, 4 Aug 2026 14:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96api=E6=96=87=E6=A1=A3ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.tsx | 9 +- frontend/src/index.css | 9 +- frontend/src/layouts/MainLayout.tsx | 1 + frontend/src/pages/MerchantCenter.tsx | 205 ++++++++++++++++++++++---- frontend/src/pages/OpenApiDocs.tsx | 11 +- 5 files changed, 185 insertions(+), 50 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index f5e199a..27434f5 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -56,14 +56,7 @@ function AppRoutes() { } /> - - - - } - /> + } /> fixedTab ?? tabFromSearch(location.search), [fixedTab, location.search]) const [merchant, setMerchant] = useState(null) const [merchantRole, setMerchantRole] = useState() @@ -790,25 +797,118 @@ export default function MerchantCenter({ fixedTab, title = '商户中心' }: Mer ) const apiKeyContent = ( - - - 用于开放 API 调用鉴权。新 Secret 只在创建后显示一次,请及时保存。每个商户最多 {apiClientMax} 个。 - {canManage && } - - + + + + + API 密钥与开放接口鉴权 + + 已配额 {apiClients.length} / {apiClientMax} + + + + + {isAdmin && ( + + )} + {canManage && ( + + )} + + + } + > +
+ + 用于第三方分销系统或自建后台调用开放 API (商品查询、订单发货) 的 HMAC-SHA256 签名鉴权凭证。新生成的 App Secret 仅在创建成功时展示一次,请妥善保存。 + +
+ +
+ ) const callbackContent = ( - - - 回调事件通过 outbox 持久化推送,失败按固定间隔退避重试(最多 16 次)后标记失败。每个商户只保留一份回调配置。 - - + + + + + Webhook 异步回调订阅设置 + {callback?.status === 'active' ? ( + + + 推送已启用 + + ) : ( + + + 推送已禁用 + + )} + + + HMAC-SHA256 签名保护 + + + } + > +
+ +
+
重试机制
+
+ Outbox 队列 + 指数退避 (最多 16 次) +
+ + +
推送信道签名 Header
+
+ X-Signature (HMAC-SHA256) +
+ + +
推送超时标准
+
+ 5000 ms 强制响应超时 +
+ + + + - - + + } + placeholder="https://your-domain.com/api/v1/webhook" + allowClear + /> - - - - - - + +
+ {callback?.updated_at ? `上次保存:${formatDateTime(callback.updated_at)}` : '尚未保存回调配置'} - + + {canManage && ( - + )} - {canManage && } + {canManage && ( + + )} - +
diff --git a/frontend/src/pages/OpenApiDocs.tsx b/frontend/src/pages/OpenApiDocs.tsx index 9ac8b25..12b8eaa 100644 --- a/frontend/src/pages/OpenApiDocs.tsx +++ b/frontend/src/pages/OpenApiDocs.tsx @@ -335,36 +335,35 @@ function OverviewSection() { pagination={false} rowKey="mode" dataSource={deliveryModes} - scroll={{ x: 1080 }} columns={[ { title: '方式', dataIndex: 'mode', - width: 140, + width: '14%', render: (v: string) => {v}, }, { title: '适用场景', dataIndex: 'scene', - width: 280, + width: '28%', render: (v: string) => {v}, }, { title: '接口顺序', dataIndex: 'steps', - width: 240, + width: '22%', render: (v: string) =>
{v}
, }, { title: '相关接口', dataIndex: 'interfaces', - width: 260, + width: '22%', render: (v: string) =>
{v}
, }, { title: '建议', dataIndex: 'recommend', - width: 180, + width: '14%', render: (v: string) => {v}, }, ]}