Last active
April 11, 2018 00:05
-
-
Save koras/18392bbd07ae21b227992ccbcc4c4c9d to your computer and use it in GitHub Desktop.
pagination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBids(uint page) public onlyContract view returns(uint32[16] rabbitID, address[16]rabbitSeller, uint[16]startMoney, uint[16]finishMoney ) { | |
uint pagecount = 16; | |
uint pageend = 0; | |
uint start = 0; | |
if (page < 1) { | |
page = 1; | |
} | |
pageend = page * pagecount; | |
if (pageend > bidsArray.length) { | |
pageend = bidsArray.length; | |
} | |
uint startArray = (page-1)*pagecount; | |
for (uint i = startArray; i < pageend; i++) { | |
start++; | |
rabbitID[start] = uint32(bidsArray[i].rabbitID); | |
rabbitSeller[start] = address(bidsArray[i].rabbitSeller); | |
startMoney[start] = uint(bidsArray[i].startMoney); | |
finishMoney[start] = uint(bidsArray[i].finishMoney); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment