Files
bl/modules/config/model/cdk.go
昔念 eebf46cc03 ```
refactor(item_use): 重构道具使用逻辑并提取常量

- 添加 ItemDefaultLeftTime 和 ItemNeuronID 常量定义
- 使用结构体字面量初始化 itemInfo,替换手动赋值
- 将神经元道具处理逻辑提取为独立方法 handleNeuronItem
- 将普通宠物道具处理逻辑提取为独立方法 handleRegularPetItem
- 优化 UsePetItemOutOfFight 方法的条件判断结构

fix(NewSeIdx_700): 修复Boss技能伤害计算参数错误

- 修正 Skill_Useed 方法中 Div 方法的参数索引,从 Args()[1]
2025-12-31 02:44:14 +08:00

61 lines
2.6 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"
"time"
)
// 表名常量定义CDK配置表
const (
TableNameCDKConfig = "cdk_config" // CDK配置表记录CDK编号、可兑换次数、奖励配置等核心信息
)
// CDKConfig CDK核心配置模型含可兑换次数满足查询`where 可兑换次数 != 0`需求)
type CDKConfig struct {
*cool.Model `json:"-" gorm:"embedded"` // 嵌入通用ModelID/创建时间/更新时间不参与json序列化
// 核心字段
CDKCode string `gorm:"not null;size:64;uniqueIndex;comment:'CDK编号唯一标识用于玩家兑换'" json:"cdk_code" description:"CDK编号"`
//cdk可兑换次数where不等于0
ExchangeRemainCount uint32 `gorm:"not null;default:1;comment:'CDK剩余可兑换次数不能为0才允许兑换支持查询where !=0'" json:"exchange_remain_count" description:"剩余可兑换次数"`
ItemRewardIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定奖励物品ID数组关联item_gift表主键'" json:"item_reward_ids" description:"奖励物品数组"`
ElfRewardIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定奖励精灵ID数组关联config_pet_boss表主键'" json:"elf_reward_ids" description:"奖励精灵数组"`
// 辅助配置字段
ValidStartTime time.Time `gorm:"not null;comment:'CDK有效开始时间'" json:"valid_start_time" description:"有效开始时间"`
ValidEndTime time.Time `gorm:"not null;comment:'CDK有效结束时间'" json:"valid_end_time" description:"有效结束时间"`
IsEnabled uint32 `gorm:"not null;default:1;comment:'是否启用该CDK0-禁用 1-启用)'" json:"is_enabled" description:"是否启用"`
Remark string `gorm:"size:512;default:'';comment:'CDK备注'" json:"remark" description:"备注信息"`
//ItemGift []*ItemGift `gorm:"-" orm:"with:item_id=id"`
}
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
func (*CDKConfig) TableName() string {
return TableNameCDKConfig
}
func (*CDKConfig) GroupName() string {
return "default"
}
func NewCDKConfig() *CDKConfig {
return &CDKConfig{
Model: cool.NewModel(),
CDKCode: "",
ExchangeRemainCount: 1, // 剩余可兑换次数默认1确保不为0
ItemRewardIds: []uint32{},
ElfRewardIds: []uint32{},
ValidStartTime: time.Now(),
ValidEndTime: time.Now().AddDate(1, 0, 0), // 默认有效期1年
IsEnabled: 1,
Remark: "",
}
}
// -------------------------- 表结构自动同步 --------------------------
func init() {
cool.CreateTable(&CDKConfig{})
}