51 lines
2.3 KiB
Go
51 lines
2.3 KiB
Go
package model
|
|
|
|
// UserDailyActive 对应 user_daily_active。
|
|
type UserDailyActive struct {
|
|
UserID int64 `gorm:"primaryKey" json:"userId"`
|
|
ActiveDate string `gorm:"primaryKey;size:10" json:"activeDate"`
|
|
LastIP string `gorm:"column:last_ip;size:64;not null;default:''" json:"lastIp"`
|
|
LastSeenAt string `gorm:"column:last_seen_at;size:32;not null;default:''" json:"lastSeenAt"`
|
|
}
|
|
|
|
func (UserDailyActive) TableName() string { return "user_daily_active" }
|
|
|
|
// AIUsageDaily 对应 ai_usage_daily。
|
|
type AIUsageDaily struct {
|
|
UserID int64 `gorm:"primaryKey" json:"userId"`
|
|
TeamID int64 `gorm:"primaryKey;default:0" json:"teamId"`
|
|
UsageDate string `gorm:"primaryKey;size:10" json:"usageDate"`
|
|
Provider string `gorm:"primaryKey;size:32;not null;default:''" json:"provider"`
|
|
PromptTokens int64 `gorm:"not null;default:0" json:"promptTokens"`
|
|
CompletionTokens int64 `gorm:"not null;default:0" json:"completionTokens"`
|
|
Calls int `gorm:"not null;default:0" json:"calls"`
|
|
Estimated int `gorm:"not null;default:0" json:"estimated"`
|
|
}
|
|
|
|
func (AIUsageDaily) TableName() string { return "ai_usage_daily" }
|
|
|
|
// AppRelease 对应 app_releases。
|
|
type AppRelease struct {
|
|
ID int64 `gorm:"primaryKey" json:"id"`
|
|
Version string `gorm:"size:32;not null" json:"version"`
|
|
Channel string `gorm:"size:16;not null;default:stable" json:"channel"`
|
|
Filename string `gorm:"size:255;not null" json:"filename"`
|
|
SHA256 string `gorm:"column:sha256;size:64;not null;default:''" json:"sha256"`
|
|
SizeBytes int64 `gorm:"column:size_bytes;not null;default:0" json:"sizeBytes"`
|
|
Changelog string `gorm:"type:mediumtext;not null" json:"changelog"`
|
|
CreatedAt string `gorm:"size:32;not null" json:"createdAt"`
|
|
IsLatest int `gorm:"column:is_latest;not null;default:0" json:"isLatest"`
|
|
}
|
|
|
|
func (AppRelease) TableName() string { return "app_releases" }
|
|
|
|
// AdminStepup 对应 admin_stepup。
|
|
type AdminStepup struct {
|
|
UserID int64 `gorm:"primaryKey" json:"userId"`
|
|
TokenHash string `gorm:"column:token_hash;size:64;not null" json:"-"`
|
|
ClientIP string `gorm:"column:client_ip;size:64;not null;default:''" json:"clientIp"`
|
|
ExpiresAt string `gorm:"column:expires_at;size:32;not null" json:"expiresAt"`
|
|
}
|
|
|
|
func (AdminStepup) TableName() string { return "admin_stepup" }
|