From e08b4d46476794633de2e348139a944bb6c4fca7 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Wed, 10 Apr 2024 15:45:09 +0800 Subject: [PATCH] 1 --- webapp/controller/ChipController.class.php | 17 +++++++++++++++ webapp/controller/HeroController.class.php | 17 +++++++++++++++ webapp/models/Chip.php | 12 +++++++++++ webapp/models/Hero.php | 24 ++++++++++++++++++++-- 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/webapp/controller/ChipController.class.php b/webapp/controller/ChipController.class.php index 9ccff492..3211a866 100644 --- a/webapp/controller/ChipController.class.php +++ b/webapp/controller/ChipController.class.php @@ -44,6 +44,23 @@ class ChipController extends BaseAuthedController )); } + public function mallChipInfo(){ + $unique_id = trim(getReqVal('unique_id', 0)); + if (! $unique_id){ + $this->_rspErr(1, 'Please enter parameter unique_id'); + return ; + } + $chipDb = Chip::findEx($unique_id); + if (! $chipDb){ + $this->_rspErr(1, "You don't have the chip yet"); + return; + } + $chip = Chip::toDto($chipDb); + $this->_rspData(array( + 'data' => $chip, + )); + } + public function upgradeQuality(){ $chipUniId = trim(getReqVal('chip_uniid', 0)); if (!$chipUniId) { diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 6859b478..3967d8ea 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -78,6 +78,23 @@ class HeroController extends BaseAuthedController { )); } + public function mallHeroInfo(){ + $unique_id = trim(getReqVal('unique_id', 0)); + if ( ! $unique_id) { + $this->_rspErr(1, 'Please enter instructions'); + return; + } + $heroDb = Hero::findEx($unique_id); + if (! $heroDb){ + $this->_rspErr(1, "You don't have the hero yet"); + return; + } + $hero = Hero::mallInfo($heroDb); + $this->_rspData(array( + 'data' => $hero + )); + } + public function skinList() { $heroId = getReqVal('hero_id',0); diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index c5bc3518..6e6b74b7 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -47,6 +47,18 @@ class Chip extends BaseModel return $row; } + public static function findEx($chipUniId) + { + $row = SqlHelper::ormSelectOne( + myself()->_getSelfMysql(), + 't_chip', + array( + 'idx' => $chipUniId, + ) + ); + return $row; + } + public static function update2($chipUniId, $fieldsKv){ if (self::find($chipUniId)) { diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 2e07d4a5..9eb86439 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -279,7 +279,7 @@ class Hero extends BaseModel { 'is_select' => $isSelect, 'lucky' => self::getHeroLucky($row), 'wealth' => self::getHeroWealth($row), - 'ability' => self::abilityInfo($row, $attr), + 'ability' => self::abilityInfo($row), 'seal_type' => $row['seal_type'], 'unseal_time' => $row['unseal_time'], 'valid_lefttime' => max(0, @@ -297,6 +297,26 @@ class Hero extends BaseModel { return $dto; } + public static function mallInfo($row){ + $attr = emptyReplace(json_decode($row['rand_attr'], true), array()); + return array( + 'idx' => $row['idx'], + 'token_id' => $row['token_id'], + 'hero_uniid' => $row['idx'], + 'hero_id' => $row['hero_id'], + 'hero_lv' => $row['hero_lv'], + 'hero_tili' => $row['hero_tili'], + 'state' => $row['state'], + 'quality' => $row['quality'], + 'skill_lv1' => $row['skill_lv1'], + 'skill_lv2' => $row['skill_lv2'], + 'rand_attr' => $attr, + 'lucky' => self::getHeroLucky($row), + 'wealth' => self::getHeroWealth($row), + 'ability' => self::abilityInfo($row), + ); + } + private static function celHeroWealthUpLimit($row){ //最大财富值和幸运值计算 @@ -348,7 +368,7 @@ class Hero extends BaseModel { return $avatarInfos; } - private static function abilityInfo($row, $attr){ + private static function abilityInfo($row ){ $info = array( 'hp' => 0, 'attack' => 0,