_getMarketMysql(), 't_nft', array( 'owner_address' => $account ), function ($row) use(&$nftList) { array_push($nftList, $row); } ); return $nftList; } public static function getNftListByType($account, $type) { $nftList = array(); SqlHelper::ormSelect( myself()->_getMarketMysql(), 't_nft', array( 'owner_address' => $account, 'token_type' => $type, ), function ($row) use(&$nftList) { array_push($nftList, $row); } ); return $nftList; } public static function getNft($tokenId) { $row = SqlHelper::ormSelectOne( myself()->_getMarketMysql(), 't_nft', array( 'token_id' => $tokenId, ) ); return $row; } public static function toDto($nftDb) { $itemMeta = mt\Item::get($nftDb['item_id']); if (!$itemMeta){ return null; } $nft = array( 'token_id' => $nftDb['token_id'], 'owner_address' => $nftDb['owner_address'], 'owner_name' => '', 'item_id' => $nftDb['item_id'], 'type' => $nftDb['token_type'], 'state' => $nftDb['token_state'], 'image' => 'https://www.cebg.games/res/avatars/' . $itemMeta['id'] . '.png', 'currency_list' => array(), 'transaction_recrod' => array(), 'info' => array( 'name' => $itemMeta['name'], 'attr' => array() ), 'mint_time' => $nftDb['createtime'] ); switch ($nftDb['token_type']) { case Nft::HERO_TYPE: { $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; } } break; case Nft::EQUIP_TYPE: { $nft['info']['level'] = 1; $nft['info']['quality'] = 1; } break; case Nft::CHIP_TYPE: { } break; default: { return null; } } return $nft; } }