diff --git a/webapp/controller/NewMarketController.class.php b/webapp/controller/NewMarketController.class.php index 1ff27bf1..1643f3ed 100644 --- a/webapp/controller/NewMarketController.class.php +++ b/webapp/controller/NewMarketController.class.php @@ -16,6 +16,11 @@ use models\Nft; class NewMarketController extends BaseController { + private function isTestMode() + { + return true; + } + public function searchBox() { $account = getReqVal('account', ''); @@ -101,32 +106,8 @@ class NewMarketController extends BaseController { $nftDbList = Nft::getNftList($accont); $nftList = array(); foreach ($nftDbList as $nftDb) { - $nft = array( - '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); - } + $nft = $this->toNftDto($nftDb); + array_push($nftList, $nft); } myself()->_rspData(array( 'nfts' => $nftList @@ -142,6 +123,15 @@ class NewMarketController extends BaseController { myself()->_rspErr(1, 'nft not exists'); return; } + $nft = $this->toNftDto($nftDb); + myself()->_rspData(array( + 'info' => $nft + )); + } + + + private function toNftDto($nftDb) + { $nft = array( 'token_id' => $nftDb['tokenId'], 'owner_address' => $nftDb['owner_address'], @@ -166,11 +156,8 @@ class NewMarketController extends BaseController { $nft['info']['advanced_count'] = 0; $nft['info']['lucky'] = 0; $nft['info']['success_rate'] = 0; - array_push($nftList, $nft); } - myself()->_rspData(array( - 'info' => $nftList - )); + return $nft; } }