package models import ( "time" "gorm.io/gorm" ) // LevelThreshold 等级阈值配置表 type LevelThreshold struct { Level int32 `gorm:"primaryKey;column:level"` // 等级 1-20 MaxExhibitionHours int64 `gorm:"not null;column:max_exhibition_hours"` // 升级到该等级需要的累计上架时长(小时) LikeBetCount int32 `gorm:"not null;column:like_bet_count"` // 升级后解锁的点赞押注次数 Description string `gorm:"type:varchar(100);column:description"` // 描述 } // TableName 指定表名 func (LevelThreshold) TableName() string { return "level_thresholds" } // LevelUpgradeCondition 等级升级条件配置表(21级+) type LevelUpgradeCondition struct { Level int32 `gorm:"primaryKey;column:level"` // 主等级(如21级) RequireTotalHours int64 `gorm:"not null;column:require_total_hours"` // 需要的总上架时长 RequireDaziLevel int32 `gorm:"default:0;column:require_dazi_level"` // 需要的搭子等级(0=不需要) Description string `gorm:"type:varchar(100);column:description"` // 描述 UpdatedAt int64 `gorm:"not null;column:updated_at"` } // TableName 指定表名 func (LevelUpgradeCondition) TableName() string { return "level_upgrade_conditions" } // BeforeUpdate 更新前钩子 func (l *LevelUpgradeCondition) BeforeUpdate(tx *gorm.DB) error { l.UpdatedAt = time.Now().UnixMilli() return nil } // LevelCapConfig 等级上限配置表 type LevelCapConfig struct { ID int64 `gorm:"primaryKey;column:id"` MaxLevel int32 `gorm:"not null;column:max_level"` // 当前等级上限 UpdatedAt int64 `gorm:"not null;column:updated_at"` } // TableName 指定表名 func (LevelCapConfig) TableName() string { return "level_cap_config" } // BeforeUpdate 更新前钩子 func (l *LevelCapConfig) BeforeUpdate(tx *gorm.DB) error { l.UpdatedAt = time.Now().UnixMilli() return nil } // UserExhibitionHours 用户累计上架时长表 type UserExhibitionHours struct { ID int64 `gorm:"primaryKey;autoIncrement;column:id"` UserID int64 `gorm:"uniqueIndex:uk_exhibition_user_star;not null;column:user_id"` StarID int64 `gorm:"uniqueIndex:uk_exhibition_user_star;not null;column:star_id"` TotalExhibitionHours int64 `gorm:"default:0;not null;column:total_exhibition_hours"` // 累计上架时长(小时) UpdatedAt int64 `gorm:"not null;column:updated_at"` } // TableName 指定表名 func (UserExhibitionHours) TableName() string { return "user_exhibition_hours" } // BeforeCreate 创建前钩子 func (u *UserExhibitionHours) BeforeCreate(tx *gorm.DB) error { u.UpdatedAt = time.Now().UnixMilli() return nil } // BeforeUpdate 更新前钩子 func (u *UserExhibitionHours) BeforeUpdate(tx *gorm.DB) error { u.UpdatedAt = time.Now().UnixMilli() return nil } // LevelUpRewardConfig 升级奖励配置表 type LevelUpRewardConfig struct { ID int64 `gorm:"primaryKey;autoIncrement;column:id"` Level int32 `gorm:"uniqueIndex:uk_level_reward_type;not null;column:level"` // 等级 RewardType string `gorm:"uniqueIndex:uk_level_reward_type;type:varchar(50);not null;column:reward_type"` // 奖励类型:crystal/like_bet_count RewardValue int64 `gorm:"default:0;column:reward_value"` // 奖励值 IsEnabled bool `gorm:"default:true;column:is_enabled"` // 功能开关 UpdatedAt int64 `gorm:"not null;column:updated_at"` } // TableName 指定表名 func (LevelUpRewardConfig) TableName() string { return "level_up_reward_config" } // BeforeUpdate 更新前钩子 func (l *LevelUpRewardConfig) BeforeUpdate(tx *gorm.DB) error { l.UpdatedAt = time.Now().UnixMilli() return nil } // DaziLevelThreshold 搭子等级阈值配置表(预留) type DaziLevelThreshold struct { Level int32 `gorm:"primaryKey;column:level"` // 搭子等级 1-N UpgradeCondition string `gorm:"type:varchar(100);column:upgrade_condition"` // 升级条件描述 ConditionParam int `gorm:"default:0;column:condition_param"` // 条件参数 Description string `gorm:"type:varchar(100);column:description"` } // TableName 指定表名 func (DaziLevelThreshold) TableName() string { return "dazi_level_thresholds" } // UserDaziLevel 用户搭子等级表(预留) type UserDaziLevel struct { ID int64 `gorm:"primaryKey;autoIncrement;column:id"` UserID int64 `gorm:"uniqueIndex:uk_dazi_user_star;not null;column:user_id"` StarID int64 `gorm:"uniqueIndex:uk_dazi_user_star;not null;column:star_id"` DaziLevel int32 `gorm:"default:1;not null;column:dazi_level"` // 搭子等级 UpdatedAt int64 `gorm:"not null;column:updated_at"` } // TableName 指定表名 func (UserDaziLevel) TableName() string { return "user_dazi_level" }