diff --git a/doc/Hero.py b/doc/Hero.py index 9e04d83d..42d9d9fb 100644 --- a/doc/Hero.py +++ b/doc/Hero.py @@ -67,6 +67,7 @@ class Hero(object): 'params': [ _common.ReqHead(), ['hero_uniid', 0, '英雄唯一id'], + ['slot_id', 0, '槽id(0-1)'], ['cost_item_id', 0, '支付方式'], ], 'response': [ @@ -95,6 +96,7 @@ class Hero(object): 'params': [ _common.ReqHead(), ['hero_uniid', 0, '英雄唯一id'], + ['slot_id', 0, '槽id(0-1)'], ['cost_item_id', 0, '支付方式'], ], 'response': [ diff --git a/webapp/bootstrap/constant.php b/webapp/bootstrap/constant.php index 2589ca5b..e53c29fa 100644 --- a/webapp/bootstrap/constant.php +++ b/webapp/bootstrap/constant.php @@ -14,7 +14,9 @@ define('TN_ACTIVE', 8002); define('TN_SHOP', 8003); define('TN_RECHARGE_UPGRADE_TIMES', 8004); define('TN_SHARE_GAMES', 8005); -define('TN_END', 8005); +define('TN_HERO_LEVEL_UP', 8006); +define('TN_HERO_QUALITY_UP', 8007); +define('TN_END', 8007); define('TN_DAILY_BEGIN', 9001); define('TN_DAILY_LOGINS', 9001); diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 4808d24f..a8e56a3a 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -89,6 +89,30 @@ class HeroController extends BaseAuthedController { public function getUpgradeLevelList() { + $baseAttrs = mt\Hero::getHeroAttr($heroMeta); + mt\AttrHelper::mergeAttr($baseAttrs, Bag::getAttrs()); + $attrs = emptyReplace(json_decode($heroDb['rand_attr'], true), array()); + $ret = mt\HeroLevel::addRandAttr($nextLevelMeta, $baseAttrs, $attrs); + if (!$ret) { + $this->_rspErr(2, 'server internal error'); + return; + } + Hero::update($heroUniId, + array( + 'hero_lv' => $heroDb['hero_lv'] + 1, + 'rand_attr' => json_encode($attrs), + 'lock_type' => Hero::LEVEL_LOCK, + 'unlock_time' => $this->_getNowTime() + $currLevelMeta['time'], + 'unlock_trade_time' => $this->_getNowTime() + $currLevelMeta['time'] + mt\Parameter::getVal('hero_lock_transaction_time', 0) + ) + ); + $rankActivityService = new service\RankActivityService(); + $rankActivityService->heroUpgradeLevel($heroDb['hero_lv'] + 1); + $propertyChgService = new services\PropertyChgService(); + $propertyChgService->addHeroChg(); + $this->_rspData(array( + 'property_chg' => $propertyChgService->toDto(), + )); } public function getUpgradeQualityList() @@ -169,31 +193,8 @@ class HeroController extends BaseAuthedController { $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); return; } - $baseAttrs = mt\Hero::getHeroAttr($heroMeta); - mt\AttrHelper::mergeAttr($baseAttrs, Bag::getAttrs()); - $attrs = emptyReplace(json_decode($heroDb['rand_attr'], true), array()); - $ret = mt\HeroLevel::addRandAttr($nextLevelMeta, $baseAttrs, $attrs); - if (!$ret) { - $this->_rspErr(2, 'server internal error'); - return; - } $this->_decItems($costItems); - Hero::update($heroUniId, - array( - 'hero_lv' => $heroDb['hero_lv'] + 1, - 'rand_attr' => json_encode($attrs), - 'lock_type' => Hero::LEVEL_LOCK, - 'unlock_time' => $this->_getNowTime() + $currLevelMeta['time'], - 'unlock_trade_time' => $this->_getNowTime() + $currLevelMeta['time'] + mt\Parameter::getVal('hero_lock_transaction_time', 0) - ) - ); - $rankActivityService = new service\RankActivityService(); - $rankActivityService->heroUpgradeLevel($heroDb['hero_lv'] + 1); - $propertyChgService = new services\PropertyChgService(); - $propertyChgService->addHeroChg(); - $this->_rspData(array( - 'property_chg' => $propertyChgService->toDto(), - )); + $this->_setV(TN_HERO_LEVEL_UP); } public function upgradeQuality()