This commit is contained in:
aozhiwei 2023-08-06 15:10:13 +08:00
parent 51b902c476
commit ca78c5e817

View File

@ -33,7 +33,7 @@ class MarketController extends BaseAuthedController {
$account = strtolower(getReqVal('account', '')); $account = strtolower(getReqVal('account', ''));
$token = getReqVal('token', ''); $token = getReqVal('token', '');
$start = getReqVal('start', 0); $start = getReqVal('start', 0);
$page_size = getReqVal('page_size', 10); $pageSize = getReqVal('page_size', 10);
$order_method = getReqVal('order_method', 0); $order_method = getReqVal('order_method', 0);
$order_asc = getReqVal('order_asc', 1); $order_asc = getReqVal('order_asc', 1);
$type = getReqVal('type', 1); $type = getReqVal('type', 1);
@ -154,11 +154,11 @@ class MarketController extends BaseAuthedController {
); );
$total = $counts[0]['count']; $total = $counts[0]['count'];
$page_end = $start + $page_size; $page_end = $start + $pageSize;
if ($page_end > $total) { if ($page_end > $total) {
$page_end = $total; $page_end = $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;
} }
@ -173,7 +173,7 @@ class MarketController extends BaseAuthedController {
$amount_filter_fn($amount_filter_array) . $amount_filter_fn($amount_filter_array) .
$search_filter_fn($search_filter_array) . $search_filter_fn($search_filter_array) .
$order_fn($order_method, $order_asc) . $order_fn($order_method, $order_asc) .
'LIMIT ' . $start . ',' . $page_size, 'LIMIT ' . $start . ',' . $pageSize,
array( array(
':token_type' => $type, ':token_type' => $type,
) )
@ -182,7 +182,7 @@ class MarketController extends BaseAuthedController {
$nfts = array(); $nfts = array();
for ($x = $start; $x < $page_end; $x++) { for ($x = $start; $x < $page_end; $x++) {
$row = $rows[$x % $page_size]; $row = $rows[$x % $pageSize];
$nftDb = Nft::getNft($row['token_id']); $nftDb = Nft::getNft($row['token_id']);
if (!$nftDb) { if (!$nftDb) {
$nftDb = Nft::findNftByOwner($account, $row['token_id']); $nftDb = Nft::findNftByOwner($account, $row['token_id']);
@ -206,7 +206,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,
)); ));
} }