Files
hfb_sys/backend/internal/model/wallet.go

37 lines
1.5 KiB
Go

package model
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:"available_balance"`
FrozenBalance float64 `gorm:"type:decimal(12,2);not null;default:0" json:"frozen_balance"`
Status string `gorm:"size:32;not null;default:'active'" json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (WalletAccount) TableName() string {
return "wallet_accounts"
}
type WalletLedger struct {
ID uint64 `gorm:"primaryKey" json:"id"`
LedgerNo string `gorm:"size:64;not null;uniqueIndex" json:"ledger_no"`
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:"amount"`
BalanceAfter float64 `gorm:"type:decimal(12,2);not null" json:"balance_after"`
BalanceType string `gorm:"size:32;not null" json:"balance_type"`
BizType string `gorm:"size:32;not null" json:"biz_type"`
BizNo string `gorm:"size:64;not null" json:"biz_no"`
Remark string `gorm:"size:255;not null;default:''" json:"remark"`
CreatedAt time.Time `json:"created_at"`
}
func (WalletLedger) TableName() string {
return "wallet_ledger"
}