From fcd496922c1ec6ac27d02fe6fe00f0156050f91f Mon Sep 17 00:00:00 2001 From: leej1012 Date: Thu, 12 Sep 2024 15:08:49 +0800 Subject: [PATCH] Add best-apr interface --- .../com/github/ontio/controller/NodesController.java | 7 ++++++- .../com/github/ontio/mapper/NodeInspireMapper.java | 1 + .../github/ontio/service/impl/NodesServiceImpl.java | 5 +++++ .../src/main/resources/mapper/NodeInspireMapper.xml | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/controller/NodesController.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/controller/NodesController.java index 5e421647..001a8e92 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/controller/NodesController.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/controller/NodesController.java @@ -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(); + } } diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/NodeInspireMapper.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/NodeInspireMapper.java index 1d4b0c96..a18ab140 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/NodeInspireMapper.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/mapper/NodeInspireMapper.java @@ -14,4 +14,5 @@ public interface NodeInspireMapper extends Mapper { int selectNodesInspireCount(); + String selectBestApr(); } \ No newline at end of file diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java index 332fb34d..4736e2a4 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java @@ -1302,4 +1302,9 @@ public ResponseBean getBadNode(Integer cycle) { List 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); + } } diff --git a/back-end-projects/Explorer/src/main/resources/mapper/NodeInspireMapper.xml b/back-end-projects/Explorer/src/main/resources/mapper/NodeInspireMapper.xml index b85718c5..6c5aea79 100644 --- a/back-end-projects/Explorer/src/main/resources/mapper/NodeInspireMapper.xml +++ b/back-end-projects/Explorer/src/main/resources/mapper/NodeInspireMapper.xml @@ -59,4 +59,14 @@ COUNT(1) FROM tbl_node_inspire + + \ No newline at end of file