1
This commit is contained in:
parent
10d9826a8d
commit
5ce39092fc
@ -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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user