From a564c68236679f1a6d748f978f16bd3e6f2d24e2 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 18 Sep 2022 09:45:36 +0800 Subject: [PATCH] 1 --- webapp/services/BattleDataService.php | 51 ++++++++++++++++++++------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 77415da3..cb20c200 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -36,14 +36,17 @@ use services\FormulaService; class BattleDataService extends BaseService { private $seasonDb = array(); + private $heroDto = null; + private $heroMeta = null; + private $weapon1Dto = null; + private $weapon2Dto = null; + private $reward = array( 'hero' => array(), 'weapon1' => array(), 'weapon2' => array(), 'items' => array() ); - private $heroDto = null; - private $heroMeta = null; private $rankActivityService = null; private $pveGeminiMeta = null; private $pveGeminiModeMeta = null; @@ -56,18 +59,40 @@ class BattleDataService extends BaseService { public function updateBattleData() { - $row = Hero::find(getReqVal('hero_uniid', 0)); - if (!$row) { - return false; - } - $this->heroDto = Hero::toDto($row); - if (Hero::heroIsLocking($heroDb)) { - return false; - } error_log(json_encode($_REQUEST)); - $this->heroMeta = mt\Hero::get($this->heroDto['hero_id']); - if (!$this->heroMeta) { - return false; + { + $heroDb = Hero::find(getReqVal('hero_uniid', 0)); + if (!$heroDb) { + return false; + } + $this->heroDto = Hero::toDto($heroDb); + if (Hero::heroIsLocking($heroDb)) { + return false; + } + $this->heroMeta = mt\Hero::get($this->heroDto['hero_id']); + if (!$this->heroMeta) { + return false; + } + } + { + $weaponUuid1 = getReqVal('weapon_uuid1', ''); + if ($weaponUuid1) { + $weaponDb = Gun::find($weaponUuid1); + if (!$weaponDb) { + return false; + } + $this->weapon1Dto = Gun::toDto($weaponDb); + } + } + { + $weaponUuid2 = getReqVal('weapon_uuid2', ''); + if ($weaponUuid2) { + $weaponDb = Gun::find($weaponUuid2); + if (!$weaponDb) { + return false; + } + $this->weapon2Dto = Gun::toDto($weaponDb); + } } $matchMode = getReqVal('match_mode'); switch ($matchMode) {