This commit is contained in:
hujiabin 2022-11-24 19:28:22 +08:00
parent 7cd25ba963
commit 84c951e2b8
2 changed files with 5 additions and 2 deletions

View File

@ -140,7 +140,7 @@ class HeroController extends BaseAuthedController {
$this->_rspErr(1, "Not enough hero skill points");
return;
}
Hero::upgradeSkill($heroUniId,$skillIdx);
Hero::upgradeSkill($heroUniId,$skillIdx,$skill['skill_point']);
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg();
$this->_rspData(array(

View File

@ -396,7 +396,7 @@ class Hero extends BaseModel {
));
}
public static function upgradeSkill($heroUniId, $skillIdx)
public static function upgradeSkill($heroUniId, $skillIdx,$skill_points)
{
if (!in_array($skillIdx, array(0, 1))) {
return;
@ -406,6 +406,9 @@ class Hero extends BaseModel {
$fieldName => function () use($fieldName) {
return "${fieldName} + 1";
},
'skill_points' => function() use ($skill_points){
return "GREATEST(0, skill_points - ${$skill_points})";
},
'modifytime' => myself()->_getNowTime()
));
}