27 lines
1.7 KiB
Go
27 lines
1.7 KiB
Go
|
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"` // 交易流水號(可對應某次業務操作,例如同一訂單的多筆變化)
|
|||
|
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"` // 資產代號,可為 BTC、ETH、GEM_RED、GEM_BLUE、POINTS ,USD, TWD 等....
|
|||
|
Amount decimal.Decimal `gorm:"column:amount"` // 變動金額(正數為收入,負數為支出)
|
|||
|
Balance decimal.Decimal `gorm:"column:balance"` // 當前錢包餘額(這筆交易後的餘額快照)
|
|||
|
CreateAt int64 `gorm:"column:create_at"` // 建立時間(UnixNano,紀錄交易發生時間)
|
|||
|
}
|
|||
|
|
|||
|
// TableName 指定 GORM 對應的資料表名稱
|
|||
|
func (t *WalletTransaction) TableName() string {
|
|||
|
return "wallet_transaction"
|
|||
|
}
|