This commit is contained in:
aozhiwei 2024-07-16 19:09:35 +08:00
parent 20d979b1ec
commit 546dd97bd5

View File

@ -442,4 +442,65 @@ class OutAppNftController extends BaseController {
return $quality; 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);
}
} }