Files
bl/modules/config/model/fusion_pet.go
昔念 026689f3ed ```
feat(cache): 添加复合键缓存操作支持

添加了基于 uint32+string 组合键的缓存操作方法,包括
GetByCompoundKey、SetByCompoundKey、DelByCompoundKey 和
ContainsByCompoundKey 方法,用于处理用户ID和会话ID的组合缓存场景

fix(vscode): 添加 cSpell 配置支持 struc 词汇

refactor(session): 移除过时的会话管理方法

移除了基于单一字符串键的会话管理方法,因为已迁移到使用
复合键的缓存操作方式
```
2026-01-19 18:51:56 +08:00

48 lines
1.7 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 model
import (
"blazing/cool"
)
const (
TableNamePetFusion = "config_fusion_pet" // 宠物融合配方表(主表)
)
// PetFusion 宠物融合配方主模型(核心配方规则)
type PetFusion struct {
*cool.Model // 嵌入通用ModelID/创建时间/更新时间等)
MainPetID int32 `gorm:"not null;comment:'主宠物ID尼尔'" json:"main_pet_id"`
SubPetID int32 `gorm:"not null;comment:'副宠物ID闪皮'" json:"sub_pet_id"`
Probability int32 `gorm:"not null;comment:'融合成功率百分比如80代表80%'" json:"probability"`
ResultPetID int32 `gorm:"not null;comment:'融合结果宠物ID卡鲁、闪尼'" json:"result_pet_id"`
Remark string `gorm:"type:varchar(255);default:'';comment:'融合配方备注(如:尼尔+闪皮=闪尼)'" json:"remark"`
IsEnable int32 `gorm:"not null;default:1;comment:'是否启用1:启用0:禁用)'" json:"is_enable"`
IsDefault int32 `gorm:"not null;default:0;comment:'是否默认配方1:默认配方0:非默认;所有配方不匹配时随机选默认配方)'" json:"is_default"`
// 关联一个配方对应多个材料gorm 一对多关联,查询时可预加载)
//Materials []*PetFusionMaterial `gorm:"foreignKey:PetFusionID;references:ID" json:"materials,omitempty"`
}
// TableName 指定主表名
func (*PetFusion) TableName() string {
return TableNamePetFusion
}
// GroupName 表分组(与原逻辑一致)
func (*PetFusion) GroupName() string {
return "default"
}
// NewPetFusion 创建主表实例
func NewPetFusion() *PetFusion {
return &PetFusion{
Model: cool.NewModel(),
}
}
// init 初始化主表结构
func init() {
cool.CreateTable(&PetFusion{})
}