This commit is contained in:
aozhiwei 2022-01-26 11:08:47 +08:00
parent 1bf2483517
commit 12aa60ec18
6 changed files with 83 additions and 27 deletions

View File

@ -71,6 +71,7 @@ CREATE TABLE `t_nft` (
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`owner_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_id', `owner_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_id',
`owner_address` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_address', `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 '创建时间', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`), PRIMARY KEY (`idx`),

View File

@ -14,8 +14,9 @@ class MarketController extends BaseController {
private function getJob() private function getJob()
{ {
$jobs = array( $jobs = array(
'Warrior', '1',
'Guardian' '2',
'3',
); );
return $jobs[rand() % count($jobs)]; return $jobs[rand() % count($jobs)];
} }
@ -36,7 +37,7 @@ class MarketController extends BaseController {
$pageInfo = array( $pageInfo = array(
'total' => 0, 'total' => 0,
'count' => 0, 'count' => 0,
'per_page' => 10, 'per_page' => 10000,
'current_page' => $page, 'current_page' => $page,
'total_pages' => 0 'total_pages' => 0
); );
@ -52,6 +53,7 @@ class MarketController extends BaseController {
$batchMetas = mt\MarketGoods::getBatchMetas($currBatchMeta['batch_id']); $batchMetas = mt\MarketGoods::getBatchMetas($currBatchMeta['batch_id']);
if ($batchMetas) { if ($batchMetas) {
foreach ($batchMetas as $meta) { foreach ($batchMetas as $meta) {
$heroMeta = mt\Hero::get($meta['item_id']);
$saleBox = array( $saleBox = array(
'box_id' => $meta['item_id'], 'box_id' => $meta['item_id'],
'item_id' => $meta['item_id'], 'item_id' => $meta['item_id'],

View File

@ -29,7 +29,7 @@ class NewMarketController extends BaseController {
return; return;
} }
$perPage = 10; $perPage = 10000;
$rows = array(); $rows = array();
$pageInfo = array( $pageInfo = array(
'total' => 0, 'total' => 0,
@ -55,7 +55,7 @@ class NewMarketController extends BaseController {
'box_id' => $meta['item_id'], 'box_id' => $meta['item_id'],
'item_id' => $meta['item_id'], 'item_id' => $meta['item_id'],
'name' => emptyReplace($heroMeta['name'], 'Hill'), 'name' => emptyReplace($heroMeta['name'], 'Hill'),
'job' => emptyReplace($heroMeta['hero_job'], 'Warrior'), 'job' => emptyReplace($heroMeta['herotype'], '1'),
'currency_list' => array( 'currency_list' => array(
array( array(
'name' => 'BNB', 'name' => 'BNB',
@ -91,6 +91,39 @@ class NewMarketController extends BaseController {
public function getNftList() public function getNftList()
{ {
$account = getReqVal('account', ''); $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() public function getNftListTest()
@ -128,6 +161,46 @@ class NewMarketController extends BaseController {
} }
public function getNftDetail() 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', ''); $account = getReqVal('account', '');
$i = 0; $i = 0;

View File

@ -1,20 +0,0 @@
<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class BoxOrder extends BaseModel {
public function getSoldNum($batchId)
{
return 0;
}
public function isBuyed($buyerAddress, $batchId)
{
return 0;
}
}

View File

@ -5,7 +5,7 @@ namespace models;
use mt; use mt;
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
class Box extends BaseModel { class BoxOrder extends BaseModel {
public function getSoldNum($batchId) public function getSoldNum($batchId)
{ {

View File

@ -12,7 +12,7 @@ class Nft extends BaseModel {
return 0; return 0;
} }
public function isBuyed($buyerAddress, $batchId) public function getNft($tokenId)
{ {
return 0; return 0;
} }