That's offset, not page!
This commit is contained in:
parent
67e9a0bde1
commit
5cc1e051b9
1 changed files with 6 additions and 4 deletions
10
lib/api.js
10
lib/api.js
|
|
@ -164,6 +164,8 @@ app.get('/pool/blocks', function (req, res) {
|
|||
|
||||
app.get('/pool/payments/:pool_type', function (req, res) {
|
||||
let pool_type = req.params.pool_type;
|
||||
let limit = typeof(req.query.limit) !== 'undefined' ? Number(req.query.limit) : 10;
|
||||
let page = typeof(req.query.page) !== 'undefined' ? Number(req.query.page) : 0;
|
||||
switch (pool_type) {
|
||||
case 'pplns':
|
||||
break;
|
||||
|
|
@ -175,9 +177,9 @@ app.get('/pool/payments/:pool_type', function (req, res) {
|
|||
return res.json({'error': 'Invalid pool type'});
|
||||
}
|
||||
let paymentIds = [];
|
||||
let query = "SELECT distinct(transaction_id) as txnID FROM payments WHERE pool_type = ? ORDER BY transaction_id";
|
||||
let query = "SELECT distinct(transaction_id) as txnID FROM payments WHERE pool_type = ? ORDER BY transaction_id LIMIT ? OFFSET ?";
|
||||
let response = [];
|
||||
global.mysql.query(query, [pool_type]).then(function (rows) {
|
||||
global.mysql.query(query, [pool_type, limit, page]).then(function (rows) {
|
||||
if (rows.length === 0) {
|
||||
return res.json([]);
|
||||
}
|
||||
|
|
@ -212,7 +214,7 @@ app.get('/pool/payments/:pool_type', function (req, res) {
|
|||
app.get('/pool/payments', function (req, res) {
|
||||
let limit = typeof(req.query.limit) !== 'undefined' ? Number(req.query.limit) : 10;
|
||||
let page = typeof(req.query.page) !== 'undefined' ? Number(req.query.page) : 0;
|
||||
let query = "SELECT * FROM transactions ORDER BY id DESC LIMIT ? page ?";
|
||||
let query = "SELECT * FROM transactions ORDER BY id DESC LIMIT ? OFFSET ?";
|
||||
global.mysql.query(query, [limit, page]).then(function (rows) {
|
||||
if (rows.length === 0) {
|
||||
return res.json([]);
|
||||
|
|
@ -238,7 +240,7 @@ app.get('/pool/payments', function (req, res) {
|
|||
});
|
||||
}).catch(function (err) {
|
||||
console.error(threadName + "Error getting miner payments: " + JSON.stringify(err));
|
||||
res.json({error: 'Issue getting miner payments'});
|
||||
res.json({error: 'Issue getting pool payments'});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue