|
|
@@ -28,7 +28,7 @@ class PetDtoFactory
|
|
|
// 创建宠物DTO
|
|
|
$petDto = new PetDataDto();
|
|
|
$petDto->id = $pet->id;
|
|
|
- $petDto->type_id = $pet->type_id ?? 0; // 如果模型中没有type_id字段,默认为0
|
|
|
+ $petDto->typeId = $pet->type_id ?? 0; // 如果模型中没有type_id字段,默认为0
|
|
|
$petDto->name = $pet->name;
|
|
|
$petDto->level = $pet->level;
|
|
|
$petDto->exp = $pet->experience;
|
|
|
@@ -47,15 +47,17 @@ class PetDtoFactory
|
|
|
$fightingCapacity = $petLogic->calculatePower($pet->id);
|
|
|
}
|
|
|
|
|
|
- $petDto->fighting_capacity = $fightingCapacity;
|
|
|
+ $petDto->fightingCapacity = $fightingCapacity;
|
|
|
$petDto->score = $fightingCapacity; // 暂时使用战力作为评分
|
|
|
|
|
|
// 设置品阶和状态
|
|
|
- $petDto->grade = $pet->grade->value;
|
|
|
+ // grade字段在数据库中是integer,直接使用
|
|
|
+ $petDto->grade = $pet->grade;
|
|
|
+ // status字段被转换为PetStatus枚举,需要获取value
|
|
|
$petDto->status = $pet->status->value;
|
|
|
|
|
|
// 获取宠物生活技能
|
|
|
- $petDto->life_skills = self::createPetLifeSkillDtos($pet);
|
|
|
+ $petDto->lifeSkills = self::createPetLifeSkillDtos($pet);
|
|
|
|
|
|
return $petDto;
|
|
|
}
|
|
|
@@ -117,7 +119,7 @@ class PetDtoFactory
|
|
|
}
|
|
|
|
|
|
$skillDto = new PetLifeSkillDto();
|
|
|
- $skillDto->skill_id = $skill->id;
|
|
|
+ $skillDto->skillId = $skill->id;
|
|
|
$skillDto->canuse = $canUse;
|
|
|
$skillDto->curnum = $cooldownRemaining;
|
|
|
$skillDto->maxnum = $skill->cool_down;
|