This commit is contained in:
aozhiwei 2022-06-14 10:26:24 +08:00
parent c63bacb4c9
commit d84d06da81
2 changed files with 11 additions and 9 deletions

View File

@ -140,7 +140,7 @@ class HeroController extends BaseAuthedController {
$heroUniId = getReqVal('hero_uniid', 0); $heroUniId = getReqVal('hero_uniid', 0);
$heroDb = Hero::find($heroUniId); $heroDb = Hero::find($heroUniId);
if (!$heroDb) { if (!$heroDb) {
$this->_rspErr(1, 'hero does not exist'); $this->_rspErr(1, 'hero does not exist1');
return; return;
} }
$heroDto = Hero::toDto($heroDb); $heroDto = Hero::toDto($heroDb);
@ -164,7 +164,7 @@ class HeroController extends BaseAuthedController {
} }
} }
if (!$found) { if (!$found) {
$this->_rspErr(1, 'hero does not exist'); $this->_rspErr(1, 'hero does not exist2');
return; return;
} }
$this->_setV(TN_HERO_LEVEL_UP, $idx, 0); $this->_setV(TN_HERO_LEVEL_UP, $idx, 0);

View File

@ -28,7 +28,9 @@ class HeroLevelAttr {
)) { )) {
$val = self::getAttrValue($meta); $val = self::getAttrValue($meta);
if ($val > 0) { if ($val > 0) {
array_push(array( array_push(
$newAttrs,
array(
'attr_id' => $meta['attr_id'], 'attr_id' => $meta['attr_id'],
'type' => $meta['type'], 'type' => $meta['type'],
'val' => $val, 'val' => $val,
@ -37,7 +39,7 @@ class HeroLevelAttr {
} }
} }
} }
AttrHelper::addRandAttrs($dbAttrs, $newAttrs); AttrHelper::mergeAttr($dbAttrs, $newAttrs);
return true; return true;
} }
@ -48,8 +50,8 @@ class HeroLevelAttr {
$totalSpace = 0; $totalSpace = 0;
foreach ($strs as $tmpStr) { foreach ($strs as $tmpStr) {
$strs2 = explode(':', $tmpStr); $strs2 = explode(':', $tmpStr);
if (count($str2) == 2) { if (count($strs2) == 2) {
$totalSpace += $str2[1]; $totalSpace += $strs2[1];
} }
} }
@ -58,11 +60,11 @@ class HeroLevelAttr {
$currSpace = 0; $currSpace = 0;
foreach ($strs as $tmpStr) { foreach ($strs as $tmpStr) {
$strs2 = explode(':', $tmpStr); $strs2 = explode(':', $tmpStr);
if (count($str2) == 2) { if (count($strs2) == 2) {
$currSpace += $str2[1]; $currSpace += $strs2[1];
} }
if ($randSpace <= $currSpace) { if ($randSpace <= $currSpace) {
return $str2[0]; return $strs2[0];
} }
} }
} }