diff --git a/webapp/controller/NewMarketController.class.php b/webapp/controller/NewMarketController.class.php new file mode 100644 index 00000000..c4f1da78 --- /dev/null +++ b/webapp/controller/NewMarketController.class.php @@ -0,0 +1,145 @@ +_rspErr(500, 'server internal error'); + return; + } + + $rows = array(); + $pageInfo = array( + 'total' => 0, + 'count' => 0, + 'per_page' => 10, + 'current_page' => $page, + 'total_pages' => 0 + ); + $presaleInfo = array( + 'batch_id' => $currBatchMeta['batch_id'], + 'countdown' => max(0, $currBatchMeta['_start_time_utc'] - myself()->_getNowTime()), + 'sold_num' => 0, + 'inventory_num' => 0, + 'hint' => $currBatchMeta['hint'], + 'buyed' => rand() % 2 < 1 ? 0 : 1 + ); + + $batchMetas = mt\MarketGoods::getBatchMetas($currBatchMeta['batch_id']); + if ($batchMetas) { + foreach ($batchMetas as $meta) { + $saleBox = array( + 'box_id' => $meta['item_id'], + 'item_id' => $meta['item_id'], + 'currency_list' => array( + array( + 'name' => 'BNB', + 'original_price' => 100, + 'discount_price' => 80, + 'contract_address' => '0xCfEB869F69431e42cdB54A4F4f105C19C080A601', + ) + ) + ); + ++$pageInfo['total']; + if ($pageInfo['total'] > $pageInfo['per_page'] * ($pageInfo['current_page'] - 1) && + count($rows) < $pageInfo['per_page']) { + array_push($rows, $saleBox); + } + } + } + + $pageInfo['count'] = count($rows); + $pageInfo['total_pages'] = ceil($pageInfo['total'] / $pageInfo['per_page']); + myself()->_rspData(array( + 'rows' => $rows, + 'page' => $pageInfo, + 'presale_info' => $presaleInfo, + )); + } + + public function buyBox() + { + myself()->_rspOk(); + } + + public function getNftList() + { + $account = getReqVal('account', ''); + $nftList = array(); + for ($i = 0; $i < 10; ++$i) { + $nft = array( + 'token_id' => $i + 1, + 'owner_address' => $account, + 'owner_name' => '', + 'item_id' => 30100 + $i * 100, + 'currency_list' => array(), + 'transaction_recrod' => array(), + 'info' => array( + 'name' => 'hero' . $i, + 'level' => 1, + 'quality' => 1, + 'hp' => 100, + 'speed' => 100, + 'atk' => 1, + 'def' => 100, + 'advanced_count' => 0, + 'lucky' => 0, + 'success_rate' => 0 + ), + 'mint_time' => myself()->_getNowTime() + ); + array_push($nftList, $nft); + } + myself()->_rspData(array( + 'nfts' => $nftList + )); + } + + public function getNftDetail() + { + $account = getReqVal('account', ''); + $i = 0; + $nft = array( + 'token_id' => $i + 1, + 'owner_address' => $account, + 'owner_name' => '', + 'item_id' => 30100 + $i * 100, + 'currency_list' => array(), + 'transaction_recrod' => array(), + 'info' => array( + 'name' => 'hero' . $i, + 'level' => 1, + 'quality' => 1, + 'hp' => 100, + 'speed' => 100, + 'atk' => 1, + 'def' => 100, + 'advanced_count' => 0, + 'lucky' => 0, + 'success_rate' => 0 + ), + 'mint_time' => myself()->_getNowTime() + ); + myself()->_rspData(array( + 'info' => $nft + )); + } + +}