This commit is contained in:
aozhiwei 2024-06-22 18:39:40 +08:00
parent 38b2c64ef7
commit 3512637806

View File

@ -176,13 +176,37 @@ class OutAppNftController extends BaseController {
myself()->_rspData($info); myself()->_rspData($info);
} }
public function nftDetailList()
{
$data = file_get_contents('php://input');
$dataJson = json_decode($data, true);
if (count($dataJson['nfts']) > 20) {
myself()->_rspErr(1, 'nfts count error');
return;
}
foreach ($dataJson['nfts'] as $row) {
$netId = $row['net_id'];
$contractAddress = $row['contract_address'];
$tokenId = $row['token_id'];
$nftDb = Nft::getNftByNetIdContractAddressTokenId($netId, $contractAddress, $tokenId);
if (!empty($nftDb)) {
$info = array();
$this->internalNftDetail($netId, $nftDb, $info);
}
}
}
public function nftDetailByContractAddress() public function nftDetailByContractAddress()
{ {
$contractAddress = getReqVal('contract_address', ''); $contractAddress = getReqVal('contract_address', '');
$netId = getReqVal('net_id', ''); $netId = getReqVal('net_id', '');
$tokenId = getReqVal('token_id', ''); $tokenId = getReqVal('token_id', '');
$nftDb = Nft::getNftByNetIdContractAddressTokenId($netId, $contractAddress, $tokenId); $nftDb = Nft::getNftByNetIdContractAddressTokenId($netId, $contractAddress, $tokenId);
$this->internalNftDetail($netId, $nftDb); $info = array();
error_log(json_encode($_REQUEST));
$this->internalNftDetail($netId, $nftDb, $info);
error_log(json_encode($info));
myself()->_rspData($info);
} }
public function nftDetailByTokenType() public function nftDetailByTokenType()
@ -191,10 +215,14 @@ class OutAppNftController extends BaseController {
$tokenType = getReqVal('token_type', ''); $tokenType = getReqVal('token_type', '');
$tokenId = getReqVal('token_id', ''); $tokenId = getReqVal('token_id', '');
$nftDb = Nft::getNftByNetIdTokenTypeTokenId($netId, $tokenType, $tokenId); $nftDb = Nft::getNftByNetIdTokenTypeTokenId($netId, $tokenType, $tokenId);
$this->internalNftDetail($netId, $nftDb); $info = array();
error_log(json_encode($_REQUEST));
$this->internalNftDetail($netId, $nftDb, $info);
error_log(json_encode($info));
myself()->_rspData($info);
} }
private function internalNftDetail($netId, $nftDb) private function internalNftDetail($netId, &$nftDb, &$info)
{ {
$info = array( $info = array(
'net_id' => $netId, 'net_id' => $netId,
@ -208,12 +236,9 @@ class OutAppNftController extends BaseController {
'image' => '', 'image' => '',
'detail' => array() 'detail' => array()
); );
error_log(json_encode($_REQUEST));
if (!empty($nftDb)) { if (!empty($nftDb)) {
$this->internalGetNftDetail($nftDb, $info); $this->internalGetNftDetail($nftDb, $info);
} }
error_log(json_encode($info));
myself()->_rspData($info);
} }
private function internalGetNftDetail($nftDb, &$info) { private function internalGetNftDetail($nftDb, &$info) {