- 新增 000070 数据库迁移:支持 chat_conversations、wallet_accounts、wallet_ledger、withdrawal_requests 按 distribution_site_id 隔离 - 消息中心:会话列表、未读数统计、站点专属客服及订单群聊与主站实现双向完全隔离 - 资金账户与提现:独立按 (user_id, distribution_site_id) 建账,分销订单自动结算至对应分站钱包,提现与流水相互独立 - 前台界面:Axios 自动透传 X-Distribution-Site-Code,钱包、提现与消息页面呈现分站专属标牌与独立说明
39 lines
1.8 KiB
Go
39 lines
1.8 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type WalletAccount struct {
|
|
ID uint64 `gorm:"primaryKey" json:"id"`
|
|
UserID uint64 `gorm:"not null;uniqueIndex:uk_wallet_accounts_user_site" json:"user_id"`
|
|
DistributionSiteID uint64 `gorm:"not null;default:0;uniqueIndex:uk_wallet_accounts_user_site" json:"distribution_site_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:idx_wallet_ledger_user_site" json:"user_id"`
|
|
DistributionSiteID uint64 `gorm:"not null;default:0;index:idx_wallet_ledger_user_site" json:"distribution_site_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"
|
|
}
|