This commit is contained in:
hujiabin 2022-08-29 19:36:08 +08:00
parent df5e42dbf3
commit 1ddb13b8fb
3 changed files with 6 additions and 19 deletions

View File

@ -54,6 +54,7 @@ class Hero(object):
'params': [ 'params': [
_common.ReqHead(), _common.ReqHead(),
['hero_uniid', 0, '英雄唯一id'], ['hero_uniid', 0, '英雄唯一id'],
['skill_uniid', 0, '技能唯一id'],
['skill_idx', 0, '技能idx 0主动技能1被动技能'], ['skill_idx', 0, '技能idx 0主动技能1被动技能'],
], ],
'response': [ 'response': [

View File

@ -138,6 +138,7 @@ class HeroController extends BaseAuthedController {
public function upgradeSkill() public function upgradeSkill()
{ {
$heroUniId = getReqVal('hero_uniid', 0); $heroUniId = getReqVal('hero_uniid', 0);
$skillUniId = getReqVal('skill_uniid', 0);
$skillIdx = getReqVal('skill_idx', 0); $skillIdx = getReqVal('skill_idx', 0);
$heroDb = Hero::find($heroUniId); $heroDb = Hero::find($heroUniId);
if (!$heroDb) { if (!$heroDb) {
@ -148,11 +149,7 @@ class HeroController extends BaseAuthedController {
$this->_rspErr(1, 'skill_idx must be 0-1'); $this->_rspErr(1, 'skill_idx must be 0-1');
return; return;
} }
if ($skillIdx){ $skill = \mt\Skill::get($skillUniId);
$skill = \mt\Skill::get($heroDb['skill_lv2']);
}else{
$skill = \mt\Skill::get($heroDb['skill_lv1']);
}
if (!$skill){ if (!$skill){
$this->_rspErr(1, "You don't have the skill yet"); $this->_rspErr(1, "You don't have the skill yet");
return; return;
@ -169,18 +166,7 @@ class HeroController extends BaseAuthedController {
$this->_rspErr(1, "Not enough hero skill points"); $this->_rspErr(1, "Not enough hero skill points");
return; return;
} }
if ($skillIdx){ Hero::upgradeSkill($heroUniId,$skillIdx);
$where = [
'skill_lv2'=>$skill['nextlv_skill'],
'modifytime' => $this->_getNowTime()
];
}else{
$where = [
'skill_lv1'=>$skill['nextlv_skill'],
'modifytime' => $this->_getNowTime()
];
}
Hero::update($heroUniId,$where);
$propertyChgService = new services\PropertyChgService(); $propertyChgService = new services\PropertyChgService();
$propertyChgService->addHeroChg(); $propertyChgService->addHeroChg();
$this->_rspData(array( $this->_rspData(array(

View File

@ -251,8 +251,8 @@ class Hero extends BaseModel {
'quality' => 1, 'quality' => 1,
'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0, 'hero_tili' => $realHeroMeta ? $realHeroMeta['tili'] : 0,
'state' => self::GETED_STATE, 'state' => self::GETED_STATE,
'skill_lv1' => $realHeroMeta['skill1list'], 'skill_lv1' => 1,
'skill_lv2' => $realHeroMeta['skill3list'], 'skill_lv2' => 1,
'rand_attr' => json_encode($randAttr), 'rand_attr' => json_encode($randAttr),
'lock_type' => self::NO_LOCK, 'lock_type' => self::NO_LOCK,
'unlock_time' => 0, 'unlock_time' => 0,