...
This commit is contained in:
parent
33b9c34729
commit
050fd81594
@ -739,79 +739,7 @@ class MarketController extends BaseAuthedController
|
|||||||
return phpcommon\bnToStr($ret_price);
|
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)
|
private function getNftGameData($nftRowInfo)
|
||||||
{
|
{
|
||||||
@ -949,4 +877,78 @@ class MarketController extends BaseAuthedController
|
|||||||
|
|
||||||
return true;
|
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,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user