```
feat: 添加ItemInfo结构体并重构抽蛋和任务系统 - 在common/data/color.go中添加ItemInfo结构体用于表示发放物品的信息 - 在common/utils/tomap.go中添加RandomSlice泛型函数用于从切片中随机选取元素 - 重构action_egg.go中的EggGamePlay功能,实现抽蛋逻辑和物品发放 - 更新fight_boss.go中使用新的ItemInfo结构体替换旧的model.ItemInfo - 修改user_talk.go中获取物品数量的逻辑 - 更新user_task.go中任务完成逻辑使用新的ItemInfo结构体 - 在egg.go中更新抽蛋结果结构体使用ItemInfo - 更新战斗奖励结构体使用ItemInfo - 在player.go中添加学习力道具处理逻辑 - 重构任务系统使用新的ItemInfo结构体 - 移除旧的model.ItemInfo定义 - 更新宠物奖励配置模型添加成长值等字段 - 实现GetEgg方法用于获取扭蛋奖励 - 修复宠物融合材料服务中的道具验证逻辑 ```
This commit is contained in:
@@ -11,22 +11,14 @@ const (
|
||||
|
||||
// PetReward 精灵奖励基础配置模型(核心存储结构,与数据库表字段一一对应)
|
||||
type PetReward struct {
|
||||
*cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段,保持与BossConfig一致)
|
||||
|
||||
MonID int32 `gorm:"not null;comment:'BOSS对应的精灵ID'" json:"mon_id"`
|
||||
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
|
||||
Effect []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS特性'" json:"effect"`
|
||||
Lv int32 `gorm:"not null;comment:'BOSS等级(LvHpMatchUser非0时此配置无效)'" json:"lv"`
|
||||
Color string `gorm:"comment:'BOSS颜色'" json:"color"`
|
||||
IsEgg uint32 `gorm:"not null;default:0;comment:'是否蛋'" json:"is_egg"` //奖励是否为扭蛋奖励
|
||||
}
|
||||
|
||||
// PetRewardEX 精灵奖励扩展配置模型(用于前端/业务层的复杂数据解析,继承基础模型)
|
||||
type PetRewardEX struct {
|
||||
PetReward // 嵌入基础精灵奖励模型
|
||||
RewardName string `json:"reward_name"` // 奖励名称(前端展示用,非数据库存储字段)
|
||||
RewardIcon string `json:"reward_icon"` // 奖励图标路径(前端展示用,非数据库存储字段)
|
||||
DropRateDesc string `json:"drop_rate_desc"` // 掉落概率描述(如"10%概率获取",前端展示用)
|
||||
*cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段,保持与BossConfig一致)
|
||||
IsEnabled uint32 `gorm:"not null;default:0;comment:'是否启用(0-禁用 1-启用)'" json:"is_enabled"`
|
||||
MonID int32 `gorm:"not null;comment:'BOSS对应的精灵ID'" json:"mon_id"`
|
||||
DV int32 `gorm:"not null;default:0;comment:'成长值'" json:"dv"`
|
||||
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
|
||||
Effect uint32 `gorm:"not null;comment:'BOSS特性'" json:"effect"`
|
||||
Lv int32 `gorm:"not null;comment:'BOSS等级(LvHpMatchUser非0时此配置无效)'" json:"lv"`
|
||||
IsEgg uint32 `gorm:"not null;default:0;comment:'是否蛋'" json:"is_egg"` //奖励是否为扭蛋奖励
|
||||
}
|
||||
|
||||
// TableName 指定PetReward对应的数据库表名(遵循现有代码规范)
|
||||
|
||||
Reference in New Issue
Block a user