From 5ce39092fc7649ad5b05e0c393bfc4cf459b686b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 22 Jun 2024 16:43:46 +0800 Subject: [PATCH] 1 --- .../controller/OutAppNftController.class.php | 52 +------------------ 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index f34b6a24..f0faa4b4 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -201,7 +201,6 @@ class OutAppNftController extends BaseController { public function nftDetail() { - $nftType = getReqVal('nft_type', ''); $contractAddress = getReqVal('contract_address', ''); $netId = getReqVal('net_id', ''); $tokenId = getReqVal('token_id', ''); @@ -217,17 +216,7 @@ class OutAppNftController extends BaseController { 'image' => '', 'detail' => array() ); - if (empty($contractAddress)) { - switch ($nftType) { - case 'hero': - { - $this->getHeroDetail($netId, $tokenId, $info); - } - break; - } - } else { - $this->internalGetNftDetail($netId, $contractAddress, $tokenId, $info); - } + $this->internalGetNftDetail($netId, $contractAddress, $tokenId, $info); error_log(json_encode($info)); myself()->_rspData($info); } @@ -277,43 +266,4 @@ class OutAppNftController extends BaseController { } } - private function getHeroDetail($netId, $tokenId, &$info) - { - $nftDb = Nft::getNftByNetIdTokenTypeTokenId($netId, Nft::HERO_TYPE, $tokenId); - if (!empty($nftDb)) { - $info['contract_address'] = $nftDb['contract_address']; - $info['token_id'] = $nftDb['token_id']; - $info['owner_address'] = $nftDb['owner_address']; - $heroDb = Hero::findByTokenId2($tokenId); - if ($heroDb) { - $heroAttrs = emptyReplace(json_decode($heroDb['wealth_attr'], true), array()); - $heroResult = \mt\EconomyAttribute::getAttrValue($heroAttrs); - $wealth = $heroResult['wealth']; - $wealth_rate = $heroResult['wealth_rate']; - $lucky = $heroResult['lucky']; - $lucky_rate = $heroResult['lucky_rate']; - $heroAbility = Hero::abilityInfo($heroDb); - $heroMeta = \mt\Hero::get($heroDb['hero_id']); - if ($heroMeta) { - $itemMeta = \mt\Item::get($heroDb['hero_id']); - $heroAtteMeta = \mt\EconomyAttribute::findByGrade($itemMeta['relationship'],$heroDb['quality']); - $info['meta_url'] = NFT_META_URL . '/hero/meta/' . $netId . '/' . $tokenId; - $info['name'] = $heroMeta['name']; - $info['item_id'] = $heroMeta['id']; - $info['type'] = $nftDb['token_type']; - $info['image'] = 'https://www.cebg.games/res/avatars/' . $heroMeta['id'] . '.png'; - $info['detail']['quality'] = $heroDb['quality']; - $info['detail']['max_mining_days'] = $heroAtteMeta['validTime']; - $info['detail']['wealth'] = floor($wealth * (1+$wealth_rate)); - $info['detail']['lucky'] = floor($lucky * (1+$lucky_rate)); - $info['detail']['hp'] = $heroAbility['hp']; - $info['detail']['atk'] = $heroAbility['attack']; - $info['detail']['def'] = $heroAbility['defence']; - $info['detail']['block'] = $heroAbility['block']; - $info['detail']['crit'] = $heroAbility['critical']; - } - } - } - } - }