app-cloudep-wallet-service/pkg/domain/entity/wallet_transaction.go

27 lines
1.7 KiB
Go
Raw Normal View History

2025-04-11 09:10:34 +00:00
package entity
import (
"code.30cm.net/digimon/app-cloudep-wallet-service/pkg/domain/wallet"
"github.com/shopspring/decimal"
)
// WalletTransaction 表示錢包中每一個餘額類型的交易細節紀錄(例如:可用金額、凍結金額分別異動)
type WalletTransaction struct {
ID int64 `gorm:"column:id"` // 資料表主鍵 ID
TransactionID int64 `gorm:"column:transaction_id"` // 對應的主交易 IDTransaction.ID
OrderID string `gorm:"column:order_id"` // 對應的訂單編號(可能與主交易相同)
Brand string `gorm:"column:brand"` // 品牌識別(用於多租戶區分)
UID string `gorm:"column:uid"` // 用戶 UID這筆交易所屬的使用者
WalletType wallet.Types `gorm:"column:wallet_type"` // 錢包類型(例如:可用、凍結、未確認等)
BusinessType int8 `gorm:"column:business_type"` // 業務類型(例如:合約、系統轉帳、分潤等)
Asset string `gorm:"column:asset"` // 幣別或資產識別碼
Amount decimal.Decimal `gorm:"column:amount"` // 異動金額(正數入帳,負數出帳)
Balance decimal.Decimal `gorm:"column:balance"` // 異動後的該錢包類型餘額
CreateTime int64 `gorm:"column:create_time;autoCreateTime"` // 創建時間Unix timestamp
}
// TableName 指定對應的資料表名稱
func (t *WalletTransaction) TableName() string {
return "wallet_transaction"
}