Skip to content

Commit

Permalink
Add best-apr interface
Browse files Browse the repository at this point in the history
  • Loading branch information
leej1012 committed Sep 12, 2024
1 parent 12a7366 commit fcd4969
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -424,5 +424,10 @@ public ResponseBean getBadNode(@RequestParam Integer cycle) {
return nodesService.getBadNode(cycle);
}


@RequestLimit(count = 60)
@ApiOperation(value = "get best apr")
@GetMapping(value = "/best-apr")
public ResponseBean getBestApr() {
return nodesService.getBestApr();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ public interface NodeInspireMapper extends Mapper<NodeInspire> {

int selectNodesInspireCount();

String selectBestApr();
}
Original file line number Diff line number Diff line change
Expand Up @@ -1302,4 +1302,9 @@ public ResponseBean getBadNode(Integer cycle) {
List<BadNode> nodeList = badNodeMapper.selectBadNodeByCycle(cycle);
return new ResponseBean(ErrorInfo.SUCCESS.code(), ErrorInfo.SUCCESS.desc(), nodeList);
}

public ResponseBean getBestApr() {
String apr = nodeInspireMapper.selectBestApr();
return new ResponseBean(ErrorInfo.SUCCESS.code(), ErrorInfo.SUCCESS.desc(), apr);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,14 @@
COUNT(1)
FROM tbl_node_inspire
</select>

<select id="selectBestApr" resultType="java.lang.String">
SELECT a.user_apy
FROM tbl_node_inspire a
INNER JOIN tbl_node_info_off_chain b
ON a.public_key = b.public_key
WHERE b.bad_actor = 0
ORDER BY a.user_apy+0 DESC
LIMIT 1;
</select>
</mapper>

0 comments on commit fcd4969

Please sign in to comment.