Commit Graph

3 Commits

Author SHA1 Message Date
wangjia 858f24f74b fix(backend): license_purchases.pay_url 512→TEXT——支付宝网关 URL 超列宽导致下单 1406 失败
真单联调发现:pay v2 redirect payload.url 是支付宝网关完整签名 URL(2KB+),
回填 pay_url 报 Data too long,且残留 out_trade_no='' 行使重试撞唯一索引。
model + schema.sql + db-schema.html 三处同步,AutoMigrate 自动 ALTER。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 23:58:57 +08:00
wangjia bc183ab7df feat(backend): license_purchases 增 amount_minor/currency/pay_url/renewed_to 列 + 存量回填(pay v2 金额口径)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:26:59 +08:00
wangjia 18925d7d15 feat(backend): 在线购买/续费对接 pay 收款中枢——下单/webhook 验签入账/续期叠加/查单兜底
- POST /license/purchase(仅管理员)建单并调 pay 下单,返回收银台 pay_url
- POST /pay/callback 公开接收器:HMAC 验签+时间戳窗口+按 out_trade_no 幂等+金额逐分核对,同事务续期
- 续期与兑换券同口径:未过期从到期日叠加、已过期从现在起算,写入 tier/max_devices/features
- 后台每 60s 查单兜底防 webhook 丢失;closed 标 failed
- 新表 license_purchases(schema.sql/AutoMigrate/testutil 同步);配置 PAY_SECRET/PAY_BASE_URL/PAY_RETURN_URL
- 契约真相源 ~/code/pay-contract openapi.yaml v1.0.0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
2026-07-03 20:40:06 +08:00