diff --git a/sql/marketdb.sql b/sql/marketdb.sql index 8d29e19d..91ef9c54 100644 --- a/sql/marketdb.sql +++ b/sql/marketdb.sql @@ -71,6 +71,7 @@ CREATE TABLE `t_nft` ( `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', `owner_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_id', `owner_address` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_address', + `owner_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_name', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`idx`), diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 54a766e9..b9bc88bb 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -14,8 +14,9 @@ class MarketController extends BaseController { private function getJob() { $jobs = array( - 'Warrior', - 'Guardian' + '1', + '2', + '3', ); return $jobs[rand() % count($jobs)]; } @@ -36,7 +37,7 @@ class MarketController extends BaseController { $pageInfo = array( 'total' => 0, 'count' => 0, - 'per_page' => 10, + 'per_page' => 10000, 'current_page' => $page, 'total_pages' => 0 ); @@ -52,6 +53,7 @@ class MarketController extends BaseController { $batchMetas = mt\MarketGoods::getBatchMetas($currBatchMeta['batch_id']); if ($batchMetas) { foreach ($batchMetas as $meta) { + $heroMeta = mt\Hero::get($meta['item_id']); $saleBox = array( 'box_id' => $meta['item_id'], 'item_id' => $meta['item_id'], diff --git a/webapp/controller/NewMarketController.class.php b/webapp/controller/NewMarketController.class.php index eeaf3d26..fddab901 100644 --- a/webapp/controller/NewMarketController.class.php +++ b/webapp/controller/NewMarketController.class.php @@ -29,7 +29,7 @@ class NewMarketController extends BaseController { return; } - $perPage = 10; + $perPage = 10000; $rows = array(); $pageInfo = array( 'total' => 0, @@ -55,7 +55,7 @@ class NewMarketController extends BaseController { 'box_id' => $meta['item_id'], 'item_id' => $meta['item_id'], 'name' => emptyReplace($heroMeta['name'], 'Hill'), - 'job' => emptyReplace($heroMeta['hero_job'], 'Warrior'), + 'job' => emptyReplace($heroMeta['herotype'], '1'), 'currency_list' => array( array( 'name' => 'BNB', @@ -91,6 +91,39 @@ class NewMarketController extends BaseController { public function getNftList() { $account = getReqVal('account', ''); + $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); + } + } + myself()->_rspData(array( + 'nfts' => $nftList + )); } public function getNftListTest() @@ -128,6 +161,46 @@ class NewMarketController extends BaseController { } public function getNftDetail() + { + $account = getReqVal('account', ''); + $tokenId = getReqVal('token_id', ''); + $nftDb = Nft::getNft($tokenId); + if (!$nftDb) { + myself()->_rspErr(1, 'nft not exists'); + return; + } + $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); + } + myself()->_rspData(array( + 'info' => $nftList + )); + } + + public function getNftDetailTest() { $account = getReqVal('account', ''); $i = 0; diff --git a/webapp/models/Box.php b/webapp/models/Box.php deleted file mode 100644 index 38baac9e..00000000 --- a/webapp/models/Box.php +++ /dev/null @@ -1,20 +0,0 @@ -