This commit is contained in:
hujiabin 2023-07-13 14:50:59 +08:00
parent 31ef1019c3
commit 9266e914bd

View File

@ -95,31 +95,39 @@ class NftController extends BaseAuthedController
$this->_rspErr(1, 'parameter error'); $this->_rspErr(1, 'parameter error');
return ; return ;
} }
$details = array(); $info = array(
"idx" => $nftDb['idx'],
"item_id" => $nftDb['item_id'],
"token_id" => $nftDb['token_id'],
"token_type" => $nftDb['token_type'],
"createtime" => $nftDb['createtime'],
"details" => array(),
);
switch ($nftDb['token_type']){ switch ($nftDb['token_type']){
case Nft::HERO_TYPE : { case Nft::HERO_TYPE : {
$heroDb = Hero::findByTokenId2($nftDb['token_id']); $heroDb = Hero::findByTokenId2($nftDb['token_id']);
if ($heroDb){ if ($heroDb){
$details = Hero::toDto($heroDb); $info['details'] = Hero::toDto($heroDb);
} }
} }
break; break;
case Nft::EQUIP_TYPE : { case Nft::EQUIP_TYPE : {
$gunDb = Gun::findByTokenId2($nftDb['token_id']); $gunDb = Gun::findByTokenId2($nftDb['token_id']);
if ($gunDb){ if ($gunDb){
$details = Gun::toDto($gunDb); $info['details'] = Gun::toDto($gunDb);
} }
} }
break; break;
case Nft::CHIP_TYPE : { case Nft::CHIP_TYPE : {
$chipDb = Chip::findByTokenId2($nftDb['token_id']); $chipDb = Chip::findByTokenId2($nftDb['token_id']);
if ($chipDb){ if ($chipDb){
$details = Chip::toDto($chipDb); $info['details'] = Chip::toDto($chipDb);
} }
} }
} }
$this->_rspData(array( $this->_rspData(array(
'info' => $details, 'info' => $info,
)); ));
} }