feat(v2): 多币种 product(ProductPrice 分币价目 + v1 元回退)+ 结算币种由渠道能力驱动
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
// ProductPrice 是套餐的分币种权威价目(int64 最小单位,与 money 口径一致)。
|
||||
// v1 Product.Price(元 string)保留为 CNY 默认价:某币种无此表行且币种=CNY 时回退解析 Price。
|
||||
// 新增 USD/USDT 等结算币种只需往本表插行,不动 Product。
|
||||
type ProductPrice struct {
|
||||
Base
|
||||
ProductID uint64 `gorm:"uniqueIndex:uq_product_currency;not null" json:"product_id"`
|
||||
Currency string `gorm:"uniqueIndex:uq_product_currency;size:16;not null" json:"currency"`
|
||||
AmountMinor int64 `gorm:"not null" json:"amount_minor"`
|
||||
}
|
||||
@@ -26,7 +26,8 @@ func OpenTestDB(t *testing.T) *gorm.DB {
|
||||
if err != nil {
|
||||
t.Fatalf("open test db: %v", err)
|
||||
}
|
||||
if err := db.AutoMigrate(&OrderV2{}, &Attempt{}, &Account{}, &Refund{}, &WebhookDelivery{}); err != nil {
|
||||
if err := db.AutoMigrate(&OrderV2{}, &Attempt{}, &Account{}, &Refund{}, &WebhookDelivery{},
|
||||
&Product{}, &ProductPrice{}); err != nil {
|
||||
t.Fatalf("migrate: %v", err)
|
||||
}
|
||||
sqlDB, _ := db.DB()
|
||||
|
||||
Reference in New Issue
Block a user