diff --git a/webapp/controller/GunController.class.php b/webapp/controller/GunController.class.php index bfc81ac4..c4143bca 100644 --- a/webapp/controller/GunController.class.php +++ b/webapp/controller/GunController.class.php @@ -779,4 +779,23 @@ class GunController extends BaseAuthedController { )); } + public function getLastQualityInfo(){ + $tokenId = getReqVal('token_id', ''); + if (!$tokenId){ + $this->_rspErr(1, ' error param'); + return; + } + $gunDb = Gun::findByTokenId2($tokenId); + if(!$gunDb || $gunDb['quality']<2){ + $this->_rspErr(1, ' error param'); + return; + } + $oldGunDb = $gunDb; + $oldGunDb['quality'] -= 1; + $this->_rspData(array( + 'new_gun' =>Gun::toDto($gunDb), + 'old_gun'=>Gun::toDto($oldGunDb) + )); + } + } diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index b065694f..9f230d0b 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -915,4 +915,23 @@ class HeroController extends BaseAuthedController { 'old_hero'=>$oldHero )); } + + public function getLastQualityInfo(){ + $tokenId = getReqVal('token_id', ''); + if (!$tokenId){ + $this->_rspErr(1, ' error param'); + return; + } + $heroDb = Hero::findByTokenId2($tokenId); + if(!$heroDb || $heroDb['quality']<2){ + $this->_rspErr(1, ' error param'); + return; + } + $oldHeroDb = $heroDb; + $oldHeroDb['quality'] -= 1; + $this->_rspData(array( + 'new_hero' =>Hero::toDto($heroDb), + 'old_hero'=>Hero::toDto($oldHeroDb) + )); + } }