功能:发货链接支持永久有效,默认 TTL=0
- DELIVERY_LINK_TTL_MINUTES 设为 0 或负数时链接永久有效(expires_at 存 NULL), 默认值由 120 改为 0,本地 .env 同步改为永久 - 新增 delivery_link_generated_at 列区分从未生成与永久链接,兼容历史数据 - 永久链接授权仅校验 HMAC 签名、不校验过期(exp=0),作废/恢复语义不变 - 前端链接有效期列对永久链接显示"永久有效"
This commit is contained in:
@@ -252,7 +252,11 @@ export function OrdersTab({
|
||||
title: '链接有效期',
|
||||
dataIndex: 'delivery_link_expires_at',
|
||||
width: 140,
|
||||
render: (_, record) => record.delivery_link_revoked_at ? <Tag color="red">已作废</Tag> : formatDateTime(record.delivery_link_expires_at),
|
||||
render: (_, record) => {
|
||||
if (record.delivery_link_revoked_at) return <Tag color="red">已作废</Tag>
|
||||
if (!record.delivery_link_expires_at) return <Tag color="green">永久有效</Tag>
|
||||
return formatDateTime(record.delivery_link_expires_at)
|
||||
},
|
||||
},
|
||||
{ title: '时间', dataIndex: 'created_at', width: 150, render: formatDateTime },
|
||||
{
|
||||
@@ -271,8 +275,9 @@ export function OrdersTab({
|
||||
if (record.delivery_link_revoked_at) {
|
||||
return <Tag color="red">已作废</Tag>
|
||||
}
|
||||
const expired = !record.delivery_link_expires_at
|
||||
|| new Date(record.delivery_link_expires_at).getTime() < Date.now()
|
||||
// expires_at 为空表示永久有效,不视为过期
|
||||
const expired = !!record.delivery_link_expires_at
|
||||
&& new Date(record.delivery_link_expires_at).getTime() < Date.now()
|
||||
if (expired) {
|
||||
return <Typography.Text type="secondary">已过期</Typography.Text>
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@ export interface FulfillmentOrder {
|
||||
cancelled_at?: string | null
|
||||
delivery_link_expires_at?: string | null
|
||||
delivery_link_revoked_at?: string | null
|
||||
delivery_link_generated_at?: string | null
|
||||
}
|
||||
|
||||
export interface CreateTestOrderResult {
|
||||
@@ -201,7 +202,7 @@ export interface DeliverySubmitResult {
|
||||
export interface DeliveryLinkResult {
|
||||
order_no: string
|
||||
delivery_url: string
|
||||
expires_at: string
|
||||
expires_at: string | null // null 表示永久有效
|
||||
exp: number
|
||||
sign: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user