Files
kra-new/internal/data/ledger/models.go
T
2026-09-23 17:42:55 +08:00

82 lines
2.2 KiB
Go

package ledger
import "time"
type WalletPO struct {
ID uint `gorm:"primaryKey"`
UserID uint `gorm:"uniqueIndex"`
DiamondBalance int64
TotalRechargeCents int64
TotalSpentDiamonds int64
CreatedAt time.Time
UpdatedAt time.Time
}
func (WalletPO) TableName() string { return "live_wallets" }
type RechargePlanPO struct {
ID uint `gorm:"primaryKey"`
Sort int `gorm:"index"`
Diamonds int64
AmountCents int64
Enabled bool
}
func (RechargePlanPO) TableName() string { return "live_recharge_plans" }
type RechargeOrderPO struct {
ID uint `gorm:"primaryKey"`
OrderNo string `gorm:"size:80;uniqueIndex"`
UserID uint `gorm:"index"`
Diamonds int64
AmountCents int64
RateCents int64
CreatedAt time.Time `gorm:"index"`
UpdatedAt time.Time
CreditedAt *time.Time `gorm:"index"`
}
func (RechargeOrderPO) TableName() string { return "live_recharge_orders" }
type GiftSendPO struct {
ID uint `gorm:"primaryKey"`
SerialNo string `gorm:"size:80;uniqueIndex"`
UserID uint `gorm:"index"`
RoomID *uint `gorm:"index"`
RoomName string `gorm:"size:120"`
AnchorUserID uint `gorm:"index"`
AnchorName string `gorm:"size:120"`
GiftID *uint `gorm:"index"`
GiftName string `gorm:"size:60"`
GiftIcon string `gorm:"size:1000"`
GiftPrice int64
Quantity int
DiamondTotal int64
RateCents int64
EquivalentCents int64
CreatedAt time.Time `gorm:"index"`
}
func (GiftSendPO) TableName() string { return "live_gift_sends" }
type BalanceAdjustmentPO struct {
ID uint `gorm:"primaryKey"`
UserID uint `gorm:"index"`
OperatorUserID uint `gorm:"index"`
Type string `gorm:"size:20"`
Amount int64
Reason string `gorm:"size:255"`
BalanceAfter int64
CreatedAt time.Time `gorm:"index"`
}
func (BalanceAdjustmentPO) TableName() string { return "live_balance_adjustments" }
type SettingPO struct {
Key string `gorm:"primaryKey;size:100"`
Value string `gorm:"type:text"`
UpdatedAt time.Time
}
func (SettingPO) TableName() string { return "live_settings" }