This commit is contained in:
aozhiwei 2022-01-26 11:18:33 +08:00
parent e3e5cb9a8c
commit 41a54c4265

View File

@ -16,6 +16,11 @@ use models\Nft;
class NewMarketController extends BaseController { class NewMarketController extends BaseController {
private function isTestMode()
{
return true;
}
public function searchBox() public function searchBox()
{ {
$account = getReqVal('account', ''); $account = getReqVal('account', '');
@ -101,33 +106,9 @@ class NewMarketController extends BaseController {
$nftDbList = Nft::getNftList($accont); $nftDbList = Nft::getNftList($accont);
$nftList = array(); $nftList = array();
foreach ($nftDbList as $nftDb) { foreach ($nftDbList as $nftDb) {
$nft = array( $nft = $this->toNftDto($nftDb);
'token_id' => $nftDb['tokenId'],
'owner_address' => $nftDb['owner_address'],
'owner_name' => $nftDb['owner_name'],
'item_id' => $nftDb['item_id'],
'currency_list' => array(),
'transaction_recrod' => array(),
'info' => array(
),
'mint_time' => $nftDb['createtime']
);
$heroMeta = mt\Hero::get($nftDb['item_id']);
if ($heroMeta) {
$nft['info']['name'] = $heroMeta['name'];
$nft['info']['job'] = $heroMeta['herotype'];
$nft['info']['level'] = 1;
$nft['info']['quality'] = 1;
$nft['info']['hp'] = $heroMeta['hp'];
$nft['info']['speed'] = $heroMeta['move_speed'];
$nft['info']['atk'] = $heroMeta['damage'];
$nft['info']['def'] = $heroMeta['defence'];
$nft['info']['advanced_count'] = 0;
$nft['info']['lucky'] = 0;
$nft['info']['success_rate'] = 0;
array_push($nftList, $nft); array_push($nftList, $nft);
} }
}
myself()->_rspData(array( myself()->_rspData(array(
'nfts' => $nftList 'nfts' => $nftList
)); ));
@ -142,6 +123,15 @@ class NewMarketController extends BaseController {
myself()->_rspErr(1, 'nft not exists'); myself()->_rspErr(1, 'nft not exists');
return; return;
} }
$nft = $this->toNftDto($nftDb);
myself()->_rspData(array(
'info' => $nft
));
}
private function toNftDto($nftDb)
{
$nft = array( $nft = array(
'token_id' => $nftDb['tokenId'], 'token_id' => $nftDb['tokenId'],
'owner_address' => $nftDb['owner_address'], 'owner_address' => $nftDb['owner_address'],
@ -166,11 +156,8 @@ class NewMarketController extends BaseController {
$nft['info']['advanced_count'] = 0; $nft['info']['advanced_count'] = 0;
$nft['info']['lucky'] = 0; $nft['info']['lucky'] = 0;
$nft['info']['success_rate'] = 0; $nft['info']['success_rate'] = 0;
array_push($nftList, $nft);
} }
myself()->_rspData(array( return $nft;
'info' => $nftList
));
} }
} }