array() ); SqlHelper::rawQueryPage( myself()->_getMySql(''), 'SELECT * FROM t_market WHERE activated=:activated', array( ':activated' => 1 ), array( 'page' => $page, 'perPage' => 10, 'filter' => array( 'data' => $queryData, 'fields' => array( array( 'name' => 'type', 'field_name' => 'type', 'cond' => '=', 'ignore_empty' => true, ), array( 'name' => 'job_filters', 'field_name' => '', 'cond' => 'custom', 'ignore_empty' => true, 'custom_func' => function () use ($queryData) { $jobFilter = $queryData['job_filters']; $arrJobFilter = explode('|', $jobFilters); $jobs = implode($arrJobFilter); return " AND (state in (${jobs})) "; } ), array( 'name' => 'search_filters', 'field_name' => '', 'cond' => 'custom', 'ignore_empty' => true, 'custom_func' => function () use ($queryData) { $searchFilter = $queryData['search_filters']; $arrSearchFilter = explode('|', $searchFilters); } ), array( 'name' => 'lv_filter', 'field_name' => 'lv', 'cond' => '>=', 'ignore_empty' => true, ), array( 'name' => 'quality_filter', 'field_name' => 'quality', 'cond' => '>=', 'ignore_empty' => true, ), array( 'name' => 'durability_filter', 'field_name' => 'durability', 'cond' => '>=', 'ignore_empty' => true, ), array( 'name' => 'price_filter', 'field_name' => '', 'cond' => 'custom', 'ignore_empty' => true, 'custom_func' => function () use ($queryData) { $searchFilter = $queryData['search_filters']; $arrSearchFilter = explode('|', $searchFilters); } ), array( 'name' => 'amount_filter', 'field_name' => '', 'cond' => 'custom', 'ignore_empty' => true, 'custom_func' => function () use ($queryData) { $searchFilter = $queryData['search_filters']; $arrSearchFilter = explode('|', $searchFilters); } ) ) ), //'orderBy' => $orderBy, 'handle' => function ($row) { array_push($out['rows'], $this->fillNftIntro($row)); } ), $out['pagination'] ); myself()->_rspData($out); } public function listMyNfts() { $address = $this->_getAddress(); if (empty($address)) { myself()->_rspData(array( 'total' => 0, 'start' => 0, 'page_size' => 0, 'nfts' => array() )); return; } $start = getReqVal('start', 0); $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 { $jobFilterArray = explode('|', $jobFilters); } $searchFilters = getReqVal('search_filters', ''); if ($searchFilters != '') { $searchFilterArray = explode('|', $searchFilters); } else { $searchFilterArray = array(); } $lvFilter = getReqVal('lv_filter', 0); $qualityFilter = getReqVal('quality_filter', 0); $durabilityFilter = getReqVal('durability_filter', 0); $rows = $this->getNftListByAccountAndType( $account, $type, $orderMethod, $orderAsc, $jobFilterArray, $searchFilterArray, $lvFilter, $qualityFilter, $durabilityFilter); $total = count($rows); $pageEnd = $start + $pageSize; if ($pageEnd > $total) { $pageEnd = $total; $start = $total - 1; $start = intval($start / $pageSize) * $pageSize; if ($start < 0) $start = 0; } $nfts = array(); for ($x = $start; $x < $pageEnd; $x++) { $row = $rows[$x]; // $this->attach_market_selling($row); array_push($nfts, $row); } $this->_rspData(array( "total" => $total, "start" => $start, "page_size" => $pageSize, 'nfts' => $nfts, )); } private function fillNftIntro($row) { $info = array( 'order_id' => $row['order_id'], 'token_id' => $row['token_id'], 'nft_token' => $row['nft_token'], 'amount' => $row['amount'], 'seller' => $row['seller'], 'currency' => $row['currency'], 'price' => $row['update_price'] ? $row['update_price'] : $row['price'], 'selltime' => $row['selltime'], 'updatetime' => $row['createtime'], ); $nftDb = Nft::getNft($row['token_id']); if ($nftDb) { $nftDb['detail'] = Nft::toDto($nftDb); } return $info; } }