Files
platforms/backend/api/internal/models/wallet_basic.go
2026-07-28 09:25:49 +08:00

22 lines
1.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "git.apinb.com/bsm-sdk/core/database"
// WalletBasic 对应 wallet_basic保存多主体统一钱包账户。
type WalletBasic struct {
Entity // 公共实体字段
OwnerType string `gorm:"column:owner_type;type:varchar(32);not null;uniqueIndex:idx_wallet_owner" json:"owner_type"` // 归属主体类型
OwnerID uint64 `gorm:"column:owner_id;not null;default:0;index" json:"owner_id"` // 归属主体自增主键
OwnerIdentity string `gorm:"column:owner_identity;type:varchar(36);not null;uniqueIndex:idx_wallet_owner" json:"owner_identity"` // 归属主体业务标识
AlipayID string `gorm:"column:alipay_id;type:varchar(128);not null;default:''" json:"alipay_id"` // 支付宝账号
AlipayName string `gorm:"column:alipay_name;type:varchar(128);not null;default:''" json:"alipay_name"` // 支付宝账户名
WxpayID string `gorm:"column:wxpay_id;type:varchar(128);not null;default:''" json:"wxpay_id"` // 微信支付账号
WxpayName string `gorm:"column:wxpay_name;type:varchar(128);not null;default:''" json:"wxpay_name"` // 微信支付账户名
PayPasswordHash string `gorm:"column:pay_password_hash;type:varchar(255);not null;default:''" json:"-"` // 支付密码哈希
Balance int64 `gorm:"column:balance;not null;default:0;check:balance >= 0" json:"balance"` // 钱包余额,单位分
WithdrawalBalance int64 `gorm:"column:withdrawal_balance;not null;default:0;check:withdrawal_balance >= 0" json:"withdrawal_balance"` // 可提现余额,单位分
}
func init() { database.AppendMigrate(&WalletBasic{}) }
func (table *WalletBasic) TableName() string { return "wallet_basic" }