...
This commit is contained in:
parent
82f1da56b3
commit
0d77b89fb0
@ -10,6 +10,10 @@ require_once('mt/Parameter.php');
|
||||
|
||||
require_once('models/BoxOrder.php');
|
||||
require_once('models/Nft.php');
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/Gun.php');
|
||||
require_once('models/Chip.php');
|
||||
require_once('models/Fragment.php');
|
||||
require_once('models/BuyRecord.php');
|
||||
|
||||
require_once('services/MarketService.php');
|
||||
@ -24,6 +28,7 @@ use models\Nft;
|
||||
use models\Hero;
|
||||
use models\Gun;
|
||||
use models\Chip;
|
||||
use models\Fragment;
|
||||
use models\BuyRecord;
|
||||
use services\MarketService;
|
||||
use services\LuckyBoxService;
|
||||
@ -537,6 +542,41 @@ class MarketController extends BaseController {
|
||||
myself()->_rspOk();
|
||||
}
|
||||
|
||||
private function getNftListByAccountAndType($account, $type) {
|
||||
$nfts = array();
|
||||
switch ($type) {
|
||||
case 1: {
|
||||
$rows = Nft::getNftListByType($account, $type);
|
||||
foreach ($rows as &$row) {
|
||||
$nftDb = Nft::getNft($row['token_id']);
|
||||
$row['info'] = Nft::toDto($nftDb);
|
||||
$row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id']));
|
||||
}
|
||||
} break;
|
||||
case 2: {
|
||||
$rows = Nft::getNftListByType($account, $type);
|
||||
foreach ($rows as &$row) {
|
||||
$nftDb = Nft::getNft($row['token_id']);
|
||||
$row['info'] = Nft::toDto($nftDb);
|
||||
$row['detail'] = Gun::toDtoInfo(Gun::findByTokenId2($row['token_id']));
|
||||
}
|
||||
} break;
|
||||
case 3: {
|
||||
$rows = Nft::getNft1155List($account, $type);
|
||||
foreach ($rows as &$row) {
|
||||
$row['detail'] = Chip::toDto(Chip::getChipByTokenId($row['token_id']));
|
||||
}
|
||||
} break;
|
||||
case 4: {
|
||||
$rows = Nft::getNft1155List($account, $type);
|
||||
} break;
|
||||
default: {
|
||||
$rows = array();
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function listSellNfts()
|
||||
{
|
||||
$account = getReqVal('account', '');
|
||||
@ -624,7 +664,9 @@ class MarketController extends BaseController {
|
||||
$lv_filter = getReqVal('lv_filter', 15);
|
||||
$account = '0x9a4d9dd2bfcad659975f0f5a480625c7929e9385';
|
||||
|
||||
$rows = Nft::getNftListByType($account, $type);
|
||||
$rows = $this->getNftListByAccountAndType($account, $type);
|
||||
// error_log(json_encode($rows[0]));
|
||||
// $rows = Nft::getNftListByType($account, $type);
|
||||
|
||||
$total = count($rows);
|
||||
$page_end = $start + $page_size;
|
||||
@ -635,40 +677,40 @@ class MarketController extends BaseController {
|
||||
if ($start<0) $start = 0;
|
||||
}
|
||||
|
||||
$nfts = array();
|
||||
for ($x = $start; $x < $page_end; $x++) {
|
||||
$row = $rows[$x];
|
||||
$nftDb = Nft::getNft($row['token_id']);
|
||||
if (!$nftDb) {
|
||||
myself()->_rspErr(1, 'nft not exists');
|
||||
return;
|
||||
}
|
||||
$nft = Nft::toDto($nftDb);
|
||||
// $nfts = array();
|
||||
// for ($x = $start; $x < $page_end; $x++) {
|
||||
// $row = $rows[$x];
|
||||
// $nftDb = Nft::getNft($row['token_id']);
|
||||
// if (!$nftDb) {
|
||||
// myself()->_rspErr(1, 'nft not exists');
|
||||
// return;
|
||||
// }
|
||||
// $nft = Nft::toDto($nftDb);
|
||||
|
||||
$t = $row['token_type'];
|
||||
switch($t) {
|
||||
case Nft::HERO_TYPE: {
|
||||
// $t = $row['token_type'];
|
||||
// switch($t) {
|
||||
// case Nft::HERO_TYPE: {
|
||||
|
||||
} break;
|
||||
case Nft::EQUIP_TYPE: {
|
||||
// } break;
|
||||
// case Nft::EQUIP_TYPE: {
|
||||
|
||||
} break;
|
||||
case Nft::CHIP_TYPE: {
|
||||
// } break;
|
||||
// case Nft::CHIP_TYPE: {
|
||||
|
||||
} break;
|
||||
default: {
|
||||
// } break;
|
||||
// default: {
|
||||
|
||||
}
|
||||
}
|
||||
$row['details'] = $nft;
|
||||
array_push($nfts, $row);
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// $row['details'] = $nft;
|
||||
// array_push($nfts, $row);
|
||||
// }
|
||||
|
||||
$this->_rspData(array(
|
||||
"total" => count($rows),
|
||||
"start" => $start,
|
||||
"page_size" => $page_size,
|
||||
'nfts' => $nfts,
|
||||
'nfts' => $rows,
|
||||
));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user