功能:发货链接支持永久有效,默认 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:
yml2213
2026-08-14 14:26:06 +08:00
parent 11bce9c87e
commit b76d8dc257
11 changed files with 147 additions and 32 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ type Config struct {
DeliveryChannel string
// DeliveryLinkSecret 发货链接签名密钥。
DeliveryLinkSecret string
// DeliveryLinkTTLMinutes 发货链接默认有效分钟数。
// DeliveryLinkTTLMinutes 发货链接有效分钟数<=0 表示永久有效
DeliveryLinkTTLMinutes int
// FulfillmentProcessingTimeoutMinutes 发货中订单超过该分钟数自动标记失败;<=0 表示关闭。
FulfillmentProcessingTimeoutMinutes int
@@ -78,7 +78,7 @@ func Load() *Config {
DeliveryBFFBaseURL: getEnv("DELIVERY_BFF_BASE_URL", "https://www.jxya.top/bff"),
DeliveryChannel: getEnv("DELIVERY_CHANNEL", "dlc"),
DeliveryLinkSecret: getEnv("DELIVERY_LINK_SECRET", getEnv("OPEN_API_SECRET", getEnv("JWT_SECRET", "affiliate-dash-dev-secret-change-me"))),
DeliveryLinkTTLMinutes: getEnvInt("DELIVERY_LINK_TTL_MINUTES", 120),
DeliveryLinkTTLMinutes: getEnvInt("DELIVERY_LINK_TTL_MINUTES", 0),
FulfillmentProcessingTimeoutMinutes: getEnvInt("FULFILLMENT_PROCESSING_TIMEOUT_MINUTES", 30),
FulfillmentTimeoutScanIntervalSeconds: getEnvInt("FULFILLMENT_TIMEOUT_SCAN_INTERVAL_SECONDS", 60),
CallbackMaxAttempts: getEnvInt("CALLBACK_MAX_ATTEMPTS", 16),