Files
sundynix-plant-be/model/plant/sys_badge_config.go
T
2026-02-12 14:34:31 +08:00

36 lines
1.7 KiB
Go

package plant
import (
"sundynix-go/global"
"sundynix-go/model/system"
)
// BadgeConfig 徽章配置
type BadgeConfig struct {
global.BaseModel
Name string `gorm:"type:varchar(64);not null;comment:徽章名称" json:"name"`
Description string `gorm:"type:varchar(255);comment:徽章描述" json:"description"`
IconId string `gorm:"type:varchar(50);comment:图标资源id" json:"iconId"`
// --- 核心维度与分组 ---
// 维度: EXPERTISE(专家), PERSISTENCE(勤勉), JOURNAL(记录)
Dimension string `gorm:"type:varchar(32);index;not null;column:dimension;comment:维度分类" json:"dimension"`
// 组ID: 用于前端聚合显示 (e.g. "fertilizerMaster")
GroupId string `gorm:"type:varchar(64);index;not null;column:group_id;comment:系列组Id" json:"groupId"`
// 等级: 1=铜, 2=银, 3=金
Tier int `gorm:"type:tinyint;default:1;column:tier;comment:等级权重" json:"tier"`
// --- 触发条件逻辑 ---
// 触发动作: ACT_FERTILIZE, ACT_WATER...
TargetAction string `gorm:"type:varchar(32);index;not null;column:target_action;comment:触发动作代码" json:"targetAction"`
// 目标阈值
Threshold int64 `gorm:"not null;column:threshold;comment:所需次数或数值" json:"threshold"`
// 比较操作符: ">=", "="
Comparator string `gorm:"type:varchar(10);default:'>=';column:comparator;comment:比较条件" json:"comparator"`
// --- 奖励 ---
RewardSunlight int64 `gorm:"not null;column:reward_sunlight;comment:奖励阳光值" json:"rewardSunlight"`
// --- 显示控制 ---
Sort int `gorm:"default:1;column:sort;comment:排序优先级" json:"sort"`
IsHidden bool `gorm:"-" json:"isHidden"`
//图标
Icon *system.Oss `json:"icon" gorm:"foreignKey:IconId"`
}