1
This commit is contained in:
parent
0da84fcf49
commit
115bd86382
@ -41,8 +41,6 @@ class Market(object):
|
|||||||
'group': 'Market',
|
'group': 'Market',
|
||||||
'url': 'webapp/index.php?c=Market&a=listMyNfts',
|
'url': 'webapp/index.php?c=Market&a=listMyNfts',
|
||||||
'params': [
|
'params': [
|
||||||
['account', '', '账号id'],
|
|
||||||
['token', '', 'token'],
|
|
||||||
['start', 0, '分页开始偏移'],
|
['start', 0, '分页开始偏移'],
|
||||||
['page_size', 0, '分页大小'],
|
['page_size', 0, '分页大小'],
|
||||||
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:等级 2:能量值 3:星级 4:tokenid'],
|
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:等级 2:能量值 3:星级 4:tokenid'],
|
||||||
@ -148,22 +146,4 @@ class Market(object):
|
|||||||
_common.RspHead()
|
_common.RspHead()
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'name': 'buyNft',
|
|
||||||
'desc': '购买NFT',
|
|
||||||
'group': 'Market',
|
|
||||||
'url': 'webapp/index.php?c=Market&a=buyNft',
|
|
||||||
'params': [
|
|
||||||
['account', '', '账号id'],
|
|
||||||
['token', '', 'token'],
|
|
||||||
['nft_token', '', 'nft_token'],
|
|
||||||
['payment_token_address', '', 'payment_token_address'],
|
|
||||||
['nonce', '', 'nonce'],
|
|
||||||
['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'],
|
|
||||||
['net_id', '', '网络id'],
|
|
||||||
],
|
|
||||||
'response': [
|
|
||||||
_common.RspHead()
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
@ -397,50 +397,62 @@ class MarketController extends BaseAuthedController
|
|||||||
|
|
||||||
public function listMyNfts()
|
public function listMyNfts()
|
||||||
{
|
{
|
||||||
$account = strtolower(getReqVal('account', ''));
|
|
||||||
$token = getReqVal('token', '');
|
|
||||||
$start = getReqVal('start', 0);
|
|
||||||
$page_size = getReqVal('page_size', 10);
|
|
||||||
$order_method = getReqVal('order_method', 0);
|
|
||||||
$order_asc = getReqVal('order_asc', 1);
|
|
||||||
$type = getReqVal('type', 1);
|
|
||||||
$job_filters = getReqVal('job_filters', '');
|
|
||||||
|
|
||||||
$address = $this->_getAddress();
|
$address = $this->_getAddress();
|
||||||
if ($address != $account) {
|
if (empty($address)) {
|
||||||
$this->_rspErr(1, 'account not match');
|
myself()->_rspData(array(
|
||||||
|
'total' => 0,
|
||||||
|
'start' => 0,
|
||||||
|
'page_size' => 0,
|
||||||
|
'nfts' => array()
|
||||||
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (empty($job_filters)) {
|
$start = getReqVal('start', 0);
|
||||||
$job_filter_array = array();
|
$pageSize = getReqVal('page_size', 10);
|
||||||
|
$orderMethod = getReqVal('order_method', 0);
|
||||||
|
$orderAsc = getReqVal('order_asc', 1);
|
||||||
|
$type = getReqVal('type', 1);
|
||||||
|
$jobFilters = getReqVal('job_filters', '');
|
||||||
|
|
||||||
|
if (empty($jobFilters)) {
|
||||||
|
$jobFilterArray = array();
|
||||||
} else {
|
} else {
|
||||||
$job_filter_array = explode('|', $job_filters);
|
$jobFilterArray = explode('|', $jobFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_filters = getReqVal('search_filters', '');
|
$searchFilters = getReqVal('search_filters', '');
|
||||||
if ($search_filters != '') {
|
if ($searchFilters != '') {
|
||||||
$search_filter_array = explode('|', $search_filters);
|
$searchFilterArray = explode('|', $searchFilters);
|
||||||
} else {
|
} else {
|
||||||
$search_filter_array = array();
|
$searchFilterArray = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$lv_filter = getReqVal('lv_filter', 0);
|
$lvFilter = getReqVal('lv_filter', 0);
|
||||||
$quality_filter = getReqVal('quality_filter', 0);
|
$qualityFilter = getReqVal('quality_filter', 0);
|
||||||
$durability_filter = getReqVal('durability_filter', 0);
|
$durabilityFilter = getReqVal('durability_filter', 0);
|
||||||
|
|
||||||
$rows = $this->getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job_filter_array, $search_filter_array, $lv_filter, $quality_filter, $durability_filter);
|
$rows = $this->getNftListByAccountAndType(
|
||||||
|
$account,
|
||||||
|
$type,
|
||||||
|
$orderMethod,
|
||||||
|
$orderAsc,
|
||||||
|
$jobFilterArray,
|
||||||
|
$searchFilterArray,
|
||||||
|
$lvFilter,
|
||||||
|
$qualityFilter,
|
||||||
|
$durabilityFilter);
|
||||||
|
|
||||||
$total = count($rows);
|
$total = count($rows);
|
||||||
$page_end = $start + $page_size;
|
$pageEnd = $start + $pageSize;
|
||||||
if ($page_end > $total) {
|
if ($pageEnd > $total) {
|
||||||
$page_end = $total;
|
$pageEnd = $total;
|
||||||
$start = $total - 1;
|
$start = $total - 1;
|
||||||
$start = intval($start / $page_size) * $page_size;
|
$start = intval($start / $pageSize) * $pageSize;
|
||||||
if ($start < 0) $start = 0;
|
if ($start < 0) $start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nfts = array();
|
$nfts = array();
|
||||||
for ($x = $start; $x < $page_end; $x++) {
|
for ($x = $start; $x < $pageEnd; $x++) {
|
||||||
$row = $rows[$x];
|
$row = $rows[$x];
|
||||||
// $this->attach_market_selling($row);
|
// $this->attach_market_selling($row);
|
||||||
array_push($nfts, $row);
|
array_push($nfts, $row);
|
||||||
@ -449,7 +461,7 @@ class MarketController extends BaseAuthedController
|
|||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
"total" => $total,
|
"total" => $total,
|
||||||
"start" => $start,
|
"start" => $start,
|
||||||
"page_size" => $page_size,
|
"page_size" => $pageSize,
|
||||||
'nfts' => $nfts,
|
'nfts' => $nfts,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user