Files
collector/internal/models/collect_assets.go
2026-04-17 14:50:34 +08:00

33 lines
1.5 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 (
"time"
"git.apinb.com/bsm-sdk/core/database"
"gorm.io/gorm"
)
// AssetSnapshot 资产快照数据库模型
type CollectorAssets struct {
ID uint `json:"id" gorm:"primaryKey;comment:主键ID"`
AccountID string `json:"account_id" gorm:"type:varchar(50);not null;index;comment:账户ID"`
Ymd int `json:"ymd" gorm:"not null;index;comment:采集日期年月日数字格式如20260407"`
Cash float64 `json:"cash" gorm:"type:decimal(15,2);not null;default:0;comment:可用资金"`
FrozenCash float64 `json:"frozen_cash" gorm:"type:decimal(15,2);not null;default:0;column:frozen_cash;comment:冻结资金"`
MarketValue float64 `json:"market_value" gorm:"type:decimal(15,2);not null;default:0;column:market_value;comment:持仓市值"`
Profit float64 `json:"profit" gorm:"type:decimal(15,2);not null;default:0;comment:当日盈亏"`
TotalAsset float64 `json:"total_asset" gorm:"type:decimal(15,2);not null;default:0;column:total_asset;comment:总资产"`
CollectedAt time.Time `json:"collected_at" gorm:"not null;index;comment:数据采集时间"`
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime;comment:记录创建时间"`
DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:软删除时间"`
}
func init() {
database.AppendMigrate(&CollectorAssets{})
}
// TableName 设置表名
func (CollectorAssets) TableName() string {
return "collector_assets"
}