You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
5.5 KiB
86 lines
5.5 KiB
package model
|
|
|
|
import "time"
|
|
|
|
// PlatformResourcePool 平台共享媒体资源池。
|
|
type PlatformResourcePool struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
TotalBytes int64 `gorm:"column:total_bytes;type:BIGINT;not null" json:"totalBytes"`
|
|
AvailableBytes int64 `gorm:"column:available_bytes;type:BIGINT;not null" json:"availableBytes"`
|
|
ConsumedBytes int64 `gorm:"column:consumed_bytes;type:BIGINT;not null" json:"consumedBytes"`
|
|
Status string `gorm:"column:status;type:VARCHAR(16);default:active" json:"status"`
|
|
Version int64 `gorm:"column:version;type:BIGINT;not null" json:"version"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (PlatformResourcePool) TableName() string { return "platform_resource_pool" }
|
|
|
|
// PlatformResourcePurchase 平台从云服务商采购的资源批次。
|
|
type PlatformResourcePurchase struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
BatchNo string `gorm:"column:batch_no;type:VARCHAR(64);not null;uniqueIndex:uk_resource_purchase_batch" json:"batchNo"`
|
|
Provider string `gorm:"column:provider;type:VARCHAR(32);not null" json:"provider"`
|
|
TotalBytes int64 `gorm:"column:total_bytes;type:BIGINT;not null" json:"totalBytes"`
|
|
UnitCost float64 `gorm:"column:unit_cost;type:DECIMAL(12,6)" json:"unitCost"`
|
|
TotalCost float64 `gorm:"column:total_cost;type:DECIMAL(14,2)" json:"totalCost"`
|
|
ExpiresAt *time.Time `gorm:"column:expires_at" json:"expiresAt"`
|
|
Status string `gorm:"column:status;type:VARCHAR(16);default:active" json:"status"`
|
|
Remark string `gorm:"column:remark;type:VARCHAR(256)" json:"remark"`
|
|
CreatedBy int64 `gorm:"column:created_by;type:BIGINT;not null" json:"createdBy"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (PlatformResourcePurchase) TableName() string { return "platform_resource_purchase" }
|
|
|
|
// TrafficPackage 用户购买的虚拟流量套餐。
|
|
type TrafficPackage struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
Code string `gorm:"column:code;type:VARCHAR(64);not null;uniqueIndex:uk_traffic_package_code" json:"code"`
|
|
Name string `gorm:"column:name;type:VARCHAR(128);not null" json:"name"`
|
|
AmountBytes int64 `gorm:"column:amount_bytes;type:BIGINT;not null" json:"amountBytes"`
|
|
Price float64 `gorm:"column:price;type:DECIMAL(10,2);not null" json:"price"`
|
|
ValidityDays int `gorm:"column:validity_days;type:INT" json:"validityDays"`
|
|
Status string `gorm:"column:status;type:VARCHAR(16);default:active" json:"status"`
|
|
Sort int `gorm:"column:sort;type:INT;default:0" json:"sort"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
|
|
}
|
|
|
|
func (TrafficPackage) TableName() string { return "traffic_package" }
|
|
|
|
// TrafficLedger 统一追加式账务流水。
|
|
type TrafficLedger struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
AccountType string `gorm:"column:account_type;type:VARCHAR(16);not null" json:"accountType"`
|
|
AccountID int64 `gorm:"column:account_id;type:BIGINT;not null" json:"accountId"`
|
|
Direction string `gorm:"column:direction;type:VARCHAR(8);not null" json:"direction"`
|
|
AmountBytes int64 `gorm:"column:amount_bytes;type:BIGINT;not null" json:"amountBytes"`
|
|
BalanceBefore int64 `gorm:"column:balance_before;type:BIGINT;not null" json:"balanceBefore"`
|
|
BalanceAfter int64 `gorm:"column:balance_after;type:BIGINT;not null" json:"balanceAfter"`
|
|
SourceType string `gorm:"column:source_type;type:VARCHAR(32);not null" json:"sourceType"`
|
|
SourceID string `gorm:"column:source_id;type:VARCHAR(128)" json:"sourceId"`
|
|
IdempotencyKey string `gorm:"column:idempotency_key;type:VARCHAR(128);not null;uniqueIndex:uk_traffic_ledger_idempotency" json:"idempotencyKey"`
|
|
OperatorID int64 `gorm:"column:operator_id;type:BIGINT" json:"operatorId"`
|
|
Remark string `gorm:"column:remark;type:VARCHAR(256)" json:"remark"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
}
|
|
|
|
func (TrafficLedger) TableName() string { return "traffic_ledger" }
|
|
|
|
// LiveBillingSegment 直播已结算的确定时间段。
|
|
type LiveBillingSegment struct {
|
|
ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"`
|
|
SessionID string `gorm:"column:session_id;type:VARCHAR(128);not null" json:"sessionId"`
|
|
UserID int64 `gorm:"column:user_id;type:BIGINT;not null" json:"userId"`
|
|
PeriodStart time.Time `gorm:"column:period_start;not null" json:"periodStart"`
|
|
PeriodEnd time.Time `gorm:"column:period_end;not null" json:"periodEnd"`
|
|
Bytes int64 `gorm:"column:bytes;type:BIGINT;not null" json:"bytes"`
|
|
Status string `gorm:"column:status;type:VARCHAR(16);default:pending" json:"status"`
|
|
IdempotencyKey string `gorm:"column:idempotency_key;type:VARCHAR(160);not null;uniqueIndex:uk_live_billing_segment_idempotency" json:"idempotencyKey"`
|
|
CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"`
|
|
SettledAt *time.Time `gorm:"column:settled_at" json:"settledAt"`
|
|
}
|
|
|
|
func (LiveBillingSegment) TableName() string { return "live_billing_segment" }
|
|
|