1
This commit is contained in:
parent
0e59a42078
commit
03b72f8195
39
doc/OutAppNft.py
Normal file
39
doc/OutAppNft.py
Normal file
@ -0,0 +1,39 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import _common
|
||||
|
||||
class OutAppNft(object):
|
||||
|
||||
def __init__(self):
|
||||
self.apis = [
|
||||
{
|
||||
'name': 'getNftList',
|
||||
'desc': 'nft列表',
|
||||
'group': 'OutAppNft',
|
||||
'url': 'webapp/index.php?c=OutAppNft&a=getNftList',
|
||||
'params': [
|
||||
['address', '', '钱包地址'],
|
||||
['type', 0, '类型 1:英雄 6:gacha 7:勋章 8:星球'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!nfts', [NftInfo()], 'nft列表'],
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
class NftInfo(object):
|
||||
|
||||
def __init__(self):
|
||||
self.fields = [
|
||||
['idx', 0, 'idx'],
|
||||
['owner_address', '', '钱包地址'],
|
||||
['item_id', 0, 'item_id'],
|
||||
['token_id', 0, 'token_id'],
|
||||
['token_type', 0, 'token_type'],
|
||||
['contract_address', '', '合约地址'],
|
||||
['image', '', '头像立绘'],
|
||||
['full_image', '', '全身立绘'],
|
||||
['!details', [], '详细'],
|
||||
]
|
42
webapp/controller/OutAppNftController.class.php
Normal file
42
webapp/controller/OutAppNftController.class.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
use phpcommon\SqlHelper;
|
||||
require_once('models/Nft.php');
|
||||
|
||||
use models\Nft;
|
||||
class OutAppNftController extends BaseController {
|
||||
|
||||
public function getNftList(){
|
||||
$address = getReqVal('address', '');
|
||||
$type = getReqVal('type', '');
|
||||
if ($type){
|
||||
$nftList = Nft::getNftListByType($address,$type);
|
||||
}else{
|
||||
$nftList = Nft::getNftList($address);
|
||||
}
|
||||
$listInfo = array();
|
||||
if ($nftList){
|
||||
foreach ($nftList as $nft) {
|
||||
$image = 'https://www.cebg.games/res/avatars/' . $nft['item_id'] . '.png';
|
||||
$full_image = 'https://www.cebg.games/res/avatars/full_' . $nft['item_id'] . '.png';
|
||||
$info = array(
|
||||
"idx" => $nft['idx'],
|
||||
"owner_address" => $nft['owner_address'],
|
||||
"item_id" => $nft['item_id'],
|
||||
"token_id" => $nft['token_id'],
|
||||
"token_type" => $nft['token_type'],
|
||||
"contract_address" => $nft['contract_address'],
|
||||
'image' => $image,
|
||||
'full_image' => $full_image,
|
||||
"details" => array(),
|
||||
);
|
||||
array_push($listInfo,$info);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_rspData(array(
|
||||
'nfts' => $listInfo,
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user