From 050fd8159406007a02a3a555ec5f4c09878574db Mon Sep 17 00:00:00 2001 From: songliang Date: Fri, 14 Jul 2023 17:36:47 +0800 Subject: [PATCH] ... --- webapp/controller/MarketController.class.php | 148 ++++++++++--------- 1 file changed, 75 insertions(+), 73 deletions(-) diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 8b6898cb..c266ea1f 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -699,7 +699,7 @@ class MarketController extends BaseAuthedController $this->_rspErr(1, 'price not match, idx:' . $idx); return; } - + $response = services\BlockChainService::gameItemMarketBuy( Transaction::BUY_GOODS_FROM_MARKET_ACTION_TYPE, $goods['owner_address'], @@ -739,79 +739,7 @@ class MarketController extends BaseAuthedController return phpcommon\bnToStr($ret_price); } - public function getSupportedCurrencyTypes() - { - $types = array(); - if (SERVER_ENV == _ONLINE) { - array_push($types, array( - 'name' => 'USDT', - 'address' => '0xc22Ffa318051d8aF4E5f2E2732d7049486fcE093', - )); - } else { - array_push($types, array( - 'name' => 'USDT', - 'address' => '0xc22Ffa318051d8aF4E5f2E2732d7049486fcE093', - )); - } - $this->_rspData(array( - 'list' => $types, - )); - } - private function getTransactionRecord() - { - $account = strtolower(getReqVal('account', '')); - $type = getReqVal('type', 0); - $start = getReqVal('start', 0); - $page_size = getReqVal('page_size', 10); - $page_size = max(1, min(100, $page_size)); - $conn = myself()->_getSelfMysql(); - - $type_filter_fn = function ($f) { - if ($f == 0) { - return ''; - } else { - return 'AND type=' . $f; - } - }; - - $counts = $conn->execQuery( - 'SELECT count(idx) as count FROM t_market_transaction_record ' . - 'WHERE (seller=:account OR buyer=:account) ' . - $type_filter_fn($type) . - ' ORDER BY createtime DESC', - array( - ':account' => $account, - ) - ); - - $total = $counts[0]['count']; - $page_end = $start + $page_size; - if ($page_end > $total) { - $page_end = $total; - $start = $total - 1; - $start = intval($start / $page_size) * $page_size; - if ($start < 0) $start = 0; - } - - $rows = $conn->execQuery( - 'SELECT * FROM t_market_transaction_record ' . - 'WHERE (seller=:account OR buyer=:account) ' . - $type_filter_fn($type) . - ' ORDER BY createtime DESC ' . - 'LIMIT ' . $start . ',' . $page_size, - array( - ':account' => $account, - ) - ); - - $this->_rspData(array( - "total" => $total, - "start" => $start, - "page_size" => $page_size, - 'nfts' => $rows, - )); - } private function getNftGameData($nftRowInfo) { @@ -949,4 +877,78 @@ class MarketController extends BaseAuthedController return true; } + + private function getSupportedCurrencyTypes() + { + $types = array(); + if (SERVER_ENV == _ONLINE) { + array_push($types, array( + 'name' => 'USDT', + 'address' => '0xc22Ffa318051d8aF4E5f2E2732d7049486fcE093', + )); + } else { + array_push($types, array( + 'name' => 'USDT', + 'address' => '0xc22Ffa318051d8aF4E5f2E2732d7049486fcE093', + )); + } + $this->_rspData(array( + 'list' => $types, + )); + } + + private function getTransactionRecord() + { + $account = strtolower(getReqVal('account', '')); + $type = getReqVal('type', 0); + $start = getReqVal('start', 0); + $page_size = getReqVal('page_size', 10); + $page_size = max(1, min(100, $page_size)); + $conn = myself()->_getSelfMysql(); + + $type_filter_fn = function ($f) { + if ($f == 0) { + return ''; + } else { + return 'AND type=' . $f; + } + }; + + $counts = $conn->execQuery( + 'SELECT count(idx) as count FROM t_market_transaction_record ' . + 'WHERE (seller=:account OR buyer=:account) ' . + $type_filter_fn($type) . + ' ORDER BY createtime DESC', + array( + ':account' => $account, + ) + ); + + $total = $counts[0]['count']; + $page_end = $start + $page_size; + if ($page_end > $total) { + $page_end = $total; + $start = $total - 1; + $start = intval($start / $page_size) * $page_size; + if ($start < 0) $start = 0; + } + + $rows = $conn->execQuery( + 'SELECT * FROM t_market_transaction_record ' . + 'WHERE (seller=:account OR buyer=:account) ' . + $type_filter_fn($type) . + ' ORDER BY createtime DESC ' . + 'LIMIT ' . $start . ',' . $page_size, + array( + ':account' => $account, + ) + ); + + $this->_rspData(array( + "total" => $total, + "start" => $start, + "page_size" => $page_size, + 'nfts' => $rows, + )); + } }