Files
hfb_sys/backend/internal/model/wallet.go
T
2026-06-09 19:04:11 +08:00

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"`
AvailableBalanceCent int64 `gorm:"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"`
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"`
AmountCent int64 `gorm:"not null;default:0" 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"`
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"
}