This commit is contained in:
songliang 2023-07-14 17:42:06 +08:00
parent 050fd81594
commit 9b4a993c5a

View File

@ -491,7 +491,7 @@ class MarketController extends BaseAuthedController
$this->_rspErr(1, 's_price not found');
return;
}
if ($s_price<=0) {
if ($s_price <= 0) {
$this->_rspErr(1, 's_price must > 0');
return;
}
@ -501,7 +501,7 @@ class MarketController extends BaseAuthedController
$this->_rspErr(1, 'amount not found');
return;
}
if ($amount<=0) {
if ($amount <= 0) {
$this->_rspErr(1, 'amount must > 0');
return;
}
@ -877,78 +877,4 @@ 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,
));
}
}