From 546dd97bd591304bdfc20c560369eff2ff15215c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Jul 2024 19:09:35 +0800 Subject: [PATCH] 1 --- .../controller/OutAppNftController.class.php | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 72ef94cc..51e3e2cf 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -442,4 +442,65 @@ class OutAppNftController extends BaseController { return $quality; } + public function getHeroList() + { + $accountId = getReqVal('account_id', ''); + $rows = SqlHelper::ormSelect( + myself()->_getMarketMysql(), + 't_hero', + array( + 'account_id' => $accountId, + ) + ); + $rspData = array( + 'rows' => array() + ); + foreach ($rows as $row) { + $info = array( + 'uniid' => '', + 'net_id' => 0, + 'contract_address' => '', + 'token_id' => '', + 'owner_address' => '', + 'meta_url' => '', + 'name' => '', + 'item_id' => 0, + 'type' => 0, + 'image' => '', + 'on_sale' => 0, + 'detail' => array() + ); + $heroDb = $row; + $info['uniid'] = $heroDb['idx']; + $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/' . $nftDb['net_id'] . '/' . $nftDb['token_id']; + $info['name'] = $heroMeta['name']; + $info['item_id'] = $heroMeta['id']; + $info['type'] = Nft::HERO_TYPE; + $info['image'] = 'https://res2.counterfire.games/nft/meta/' . $heroMeta['id'] . '_' . $this->getRealHeroQuality($heroDb) . '.gif'; + $info['detail']['quality'] = $this->getRealHeroQuality($heroDb); + $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']; + } + array_push($rspData['rows'], $info); + } + myself()->_rspData($rspData); + } + }