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');
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']){
case Nft::HERO_TYPE : {
$heroDb = Hero::findByTokenId2($nftDb['token_id']);
if ($heroDb){
$details = Hero::toDto($heroDb);
$info['details'] = Hero::toDto($heroDb);
}
}
break;
case Nft::EQUIP_TYPE : {
$gunDb = Gun::findByTokenId2($nftDb['token_id']);
if ($gunDb){
$details = Gun::toDto($gunDb);
$info['details'] = Gun::toDto($gunDb);
}
}
break;
case Nft::CHIP_TYPE : {
$chipDb = Chip::findByTokenId2($nftDb['token_id']);
if ($chipDb){
$details = Chip::toDto($chipDb);
$info['details'] = Chip::toDto($chipDb);
}
}
}
$this->_rspData(array(
'info' => $details,
'info' => $info,
));
}