feat(user-talk): 优化聊天功能中的物品奖励逻辑

重构 Talk 方法中物品奖励的获取方式,使用新的配置服务以支持多物品 ID 奖励机制。
移除了对 github.com/gogf/gf/v2/util/grand 包的依赖,改为通过服务获取实际物品数量。

同时更新了相关模型定义:
- 修改 MineralCollectionConfig 中 ItemID 为数组形式以支持多个物品配置
- 调整 ItemGift 模型字段
This commit is contained in:
2025-12-22 19:04:16 +08:00
parent 8505bfd4e3
commit cf7736a3e7
10 changed files with 86 additions and 49 deletions

View File

@@ -25,11 +25,11 @@ type CDKConfig struct {
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 `orm:"with:item_id=id"`
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"`
}
// -------------------------- 核心配套方法(遵循项目规范)--------------------------