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>
This commit is contained in:
wangjia
2026-07-14 23:58:57 +08:00
parent 94a5f437a5
commit 858f24f74b
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ type LicensePurchase struct {
ProductBizCode string `gorm:"size:64;not null" json:"product_biz_code"`
AmountMinor int64 `gorm:"not null;default:0" json:"amount_minor"` // v2 口径:最小单位(CNY=分)
Currency string `gorm:"size:8;not null;default:''" json:"currency"`
PayURL string `gorm:"size:512" json:"pay_url,omitempty"` // v2 session payload.url,订单管理「继续支付」复用
PayURL string `gorm:"type:text" json:"pay_url,omitempty"` // v2 session payload.url(支付宝网关 URL 带签名参数可超 2KB),订单管理「继续支付」复用
RenewedTo *time.Time `json:"renewed_to,omitempty"` // settle 续期后的授权到期日(订单流水「授权续期至」展示)
Amount string `gorm:"size:16" json:"amount"` // Deprecated: v1 元字符串,只读兜底输出,观察一版后 DROP
OutTradeNo string `gorm:"size:64;uniqueIndex:uk_out_trade_no" json:"out_trade_no"`
+1 -1
View File
@@ -169,7 +169,7 @@ CREATE TABLE IF NOT EXISTS `license_purchases` (
`product_biz_code` VARCHAR(64) NOT NULL COMMENT '套餐稳定码(monthly_standard/annual_standard/monthly_pro/annual_pro)',
`amount_minor` BIGINT NOT NULL DEFAULT 0 COMMENT 'v2 口径:最小单位金额(CNY=分)',
`currency` VARCHAR(8) NOT NULL DEFAULT '' COMMENT 'v2 口径:币种,如 CNY',
`pay_url` VARCHAR(512) DEFAULT NULL COMMENT 'v2 下单 session payload.url,订单管理「继续支付」复用',
`pay_url` TEXT DEFAULT NULL COMMENT 'v2 下单 session payload.url(支付宝网关 URL 带签名参数可超 2KB),订单管理「继续支付」复用',
`renewed_to` DATETIME DEFAULT NULL COMMENT 'settle 续期后的授权到期日(订单流水「授权续期至」展示)',
`amount` VARCHAR(16) DEFAULT NULL COMMENT 'Deprecated: v1 元字符串,如 2999.00,观察一版后 DROP',
`out_trade_no` VARCHAR(64) DEFAULT NULL COMMENT 'pay 订单号',