From 4b25fe4a47bd3a06f7cb7e59916106e13ca4c2a4 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 10 Nov 2022 17:17:03 +0800 Subject: [PATCH] 1 --- webapp/controller/GunController.class.php | 19 +++++++++++++++++++ webapp/controller/HeroController.class.php | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) 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) + )); + } }