refactor(logic): 重构逻辑层代码

- 更新导入路径和结构体命名
- 调整函数签名和返回类型
- 移除未使用的代码文件
- 统一错误处理方式
This commit is contained in:
2025-07-26 00:48:57 +08:00
parent cb87fda0d1
commit 82075b0884
13 changed files with 386 additions and 198 deletions

View File

@@ -13,47 +13,40 @@ type Pet struct {
Data string `gorm:"type:text;not null;comment:'精灵全部数据'" json:"data"`
}
type PetInfo struct {
CapturePlayerID uint64 `gorm:"not null;comment:'捕获者ID'" json:"capture_player_id"`
CaptureTime int64 `gorm:"not null;comment:'捕获时间(时间戳)'" json:"capture_time"`
CaptureMap int32 `gorm:"not null;comment:'捕获地图ID'" json:"capture_map"`
CaptureRect int16 `gorm:"not null;default:0;comment:'捕获区域(未知用途默认为0)'" json:"capture_rect"`
CaptureLevel int16 `gorm:"not null;default:0;comment:'捕获时的等级'" json:"capture_level"`
PetTypeID int32 `gorm:"not null;comment:'精灵类型ID/精灵图鉴ID'" json:"pet_type_id"`
IndividualValue int16 `gorm:"not null;comment:'个体值(DV)'" json:"individual_value"`
Nature int16 `gorm:"not null;comment:'性格类型'" json:"nature"`
AbilityTypeEnum int16 `gorm:"comment:'特性枚举'" json:"ability_type_enum"`
Shiny int32 `gorm:"not null;default:0;comment:'闪光ID(异色!=0非异色=0)'" json:"shiny"`
Level int16 `gorm:"not null;default:1;comment:'当前等级'" json:"level"`
CurrentExp int32 `gorm:"not null;default:0;comment:'当前等级已获得经验值'" json:"current_exp"`
CurrentHP int32 `gorm:"not null;comment:'当前生命值'" json:"current_hp"`
MaxHP int32 `gorm:"not null;comment:'实际最大生命值'" json:"max_hp"`
Attack int32 `gorm:"not null;comment:'实际攻击力'" json:"attack"`
Defense int32 `gorm:"not null;comment:'实际防御力'" json:"defense"`
SpecialAttack int32 `gorm:"not null;comment:'实际特殊攻击力'" json:"special_attack"`
SpecialDefense int32 `gorm:"not null;comment:'实际特殊防御力'" json:"special_defense"`
Speed int32 `gorm:"not null;comment:'实际速度'" json:"speed"`
EvHP int16 `gorm:"not null;default:0;comment:'生命值学习力'" json:"ev_hp"`
EvAttack int16 `gorm:"not null;default:0;comment:'攻击学习力'" json:"ev_attack"`
EvDefense int16 `gorm:"not null;default:0;comment:'防御学习力'" json:"ev_defense"`
EvSpecialAttack int16 `gorm:"not null;default:0;comment:'特殊攻击学习力'" json:"ev_special_attack"`
EvSpecialDefense int16 `gorm:"not null;default:0;comment:'特殊防御学习力'" json:"ev_special_defense"`
EvSpeed int16 `gorm:"not null;default:0;comment:'速度学习力'" json:"ev_speed"`
Skill1ID int32 `gorm:"not null;default:0;comment:'技能1'" json:"skill_1_id"`
Skill2ID int32 `gorm:"not null;default:0;comment:'技能2'" json:"skill_2_id"`
Skill3ID int32 `gorm:"not null;default:0;comment:'技能3'" json:"skill_3_id"`
Skill4ID int32 `gorm:"not null;default:0;comment:'技能4'" json:"skill_4_id"`
Skill1PP int16 `gorm:"not null;default:0;comment:'技能1PP'" json:"skill_1_pp"`
Skill2PP int16 `gorm:"not null;default:0;comment:'技能2PP'" json:"skill_2_pp"`
Skill3PP int16 `gorm:"not null;default:0;comment:'技能3PP'" json:"skill_3_pp"`
Skill4PP int16 `gorm:"not null;default:0;comment:'技能4PP'" json:"skill_4_pp"`
ElementalOrbID int32 `gorm:"not null;default:0;comment:'属性能量珠ID'" json:"elemental_orb_id"`
SpecialOrbID int32 `gorm:"not null;default:0;comment:'平衡/暴击能量珠ID'" json:"special_orb_id"`
ElementalOrbCount int16 `gorm:"not null;default:0;comment:'属性能量珠剩余使用次数'" json:"elemental_orb_count"`
SpecialOrbCount int16 `gorm:"not null;default:0;comment:'平衡/暴击能量珠剩余使用次数'" json:"special_orb_count"`
IndividualGuarantee int64 `gorm:"not null;default:0;comment:'个体值保底(0=无保底)'" json:"individual_guarantee"`
NatureGuarantee int64 `gorm:"not null;default:0;comment:'性格保底(0=无保底)'" json:"nature_guarantee"`
Freed bool `gorm:"default:false;not null;comment:'是否已放生(0=未放生,1=已放生)'" json:"freed"`
FreedTime string `gorm:"comment:'放生时间'" json:"freed_time"`
CapturePlayerID uint64 `gorm:"not null;comment:'捕获者ID'" json:"capture_player_id"`
CaptureTime int64 `gorm:"not null;comment:'捕获时间(时间戳)'" json:"capture_time"`
CaptureMap int32 `gorm:"not null;comment:'捕获地图ID'" json:"capture_map"`
CaptureRect int16 `gorm:"not null;default:0;comment:'捕获区域(未知用途默认为0)'" json:"capture_rect"`
CaptureLevel int16 `gorm:"not null;default:0;comment:'捕获时的等级'" json:"capture_level"`
PetTypeID int32 `gorm:"not null;comment:'精灵类型ID/精灵图鉴ID'" json:"pet_type_id"`
IndividualValue int16 `gorm:"not null;comment:'个体值(DV)'" json:"individual_value"`
Nature int16 `gorm:"not null;comment:'性格类型'" json:"nature"`
AbilityTypeEnum int16 `gorm:"comment:'特性枚举'" json:"ability_type_enum"`
Shiny int32 `gorm:"not null;default:0;comment:'闪光ID(异色!=0非异色=0)'" json:"shiny"`
Level int16 `gorm:"not null;default:1;comment:'当前等级'" json:"level"`
CurrentExp int32 `gorm:"not null;default:0;comment:'当前等级已获得经验值'" json:"current_exp"`
CurrentHP int32 `gorm:"not null;comment:'当前生命值'" json:"current_hp"`
MaxHP int32 `gorm:"not null;comment:'实际最大生命值'" json:"max_hp"`
Attack int32 `gorm:"not null;comment:'实际攻击力'" json:"attack"`
Defense int32 `gorm:"not null;comment:'实际防御力'" json:"defense"`
SpecialAttack int32 `gorm:"not null;comment:'实际特殊攻击力'" json:"special_attack"`
SpecialDefense int32 `gorm:"not null;comment:'实际特殊防御力'" json:"special_defense"`
Speed int32 `gorm:"not null;comment:'实际速度'" json:"speed"`
EvHP int16 `gorm:"not null;default:0;comment:'生命值学习力'" json:"ev_hp"`
EvAttack int16 `gorm:"not null;default:0;comment:'攻击学习力'" json:"ev_attack"`
EvDefense int16 `gorm:"not null;default:0;comment:'防御学习力'" json:"ev_defense"`
EvSpecialAttack int16 `gorm:"not null;default:0;comment:'特殊攻击学习力'" json:"ev_special_attack"`
EvSpecialDefense int16 `gorm:"not null;default:0;comment:'特殊防御学习力'" json:"ev_special_defense"`
EvSpeed int16 `gorm:"not null;default:0;comment:'速度学习力'" json:"ev_speed"`
PetSkill []PetSkillInfo //技能组
ElementalOrbID int32 `gorm:"not null;default:0;comment:'属性能量珠ID'" json:"elemental_orb_id"`
SpecialOrbID int32 `gorm:"not null;default:0;comment:'平衡/暴击能量珠ID'" json:"special_orb_id"`
ElementalOrbCount int16 `gorm:"not null;default:0;comment:'属性能量珠剩余使用次数'" json:"elemental_orb_count"`
SpecialOrbCount int16 `gorm:"not null;default:0;comment:'平衡/暴击能量珠剩余使用次数'" json:"special_orb_count"`
IndividualGuarantee int64 `gorm:"not null;default:0;comment:'个体值保底(0=无保底)'" json:"individual_guarantee"`
NatureGuarantee int64 `gorm:"not null;default:0;comment:'性格保底(0=无保底)'" json:"nature_guarantee"`
Freed bool `gorm:"default:false;not null;comment:'是否已放生(0=未放生,1=已放生)'" json:"freed"`
FreedTime string `gorm:"comment:'放生时间'" json:"freed_time"`
}
type PetSkillInfo struct {