第 4 阶段:订单、交接与账务--ok

This commit is contained in:
yml
2026-05-22 16:14:23 +08:00
parent edda1fbc7b
commit 9ebdfab078
17 changed files with 719 additions and 4 deletions
+36
View File
@@ -0,0 +1,36 @@
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"
}