统一金额分制重构

This commit is contained in:
yml
2026-06-09 19:04:11 +08:00
parent 87673288ef
commit 5cd3ead4bd
69 changed files with 886 additions and 1277 deletions
-4
View File
@@ -5,9 +5,7 @@ import "time"
type WalletAccount struct {
ID uint64 `gorm:"primaryKey" json:"id"`
UserID uint64 `gorm:"not null;uniqueIndex" json:"user_id"`
AvailableBalance float64 `gorm:"type:decimal(12,2);not null;default:0" json:"-"`
AvailableBalanceCent int64 `gorm:"not null;default:0" json:"-"`
FrozenBalance float64 `gorm:"type:decimal(12,2);not null;default:0" json:"-"`
FrozenBalanceCent int64 `gorm:"not null;default:0" json:"-"`
Status string `gorm:"size:32;not null;default:'active'" json:"status"`
CreatedAt time.Time `json:"created_at"`
@@ -24,9 +22,7 @@ type WalletLedger struct {
UserID uint64 `gorm:"not null;index" json:"user_id"`
OrderID *uint64 `json:"order_id"`
Direction string `gorm:"size:16;not null" json:"direction"`
Amount float64 `gorm:"type:decimal(12,2);not null" json:"-"`
AmountCent int64 `gorm:"not null;default:0" json:"-"`
BalanceAfter float64 `gorm:"type:decimal(12,2);not null" json:"-"`
BalanceAfterCent int64 `gorm:"not null;default:0" json:"-"`
BalanceType string `gorm:"size:32;not null" json:"balance_type"`
BizType string `gorm:"size:32;not null" json:"biz_type"`