Skip to content

Commit

Permalink
Update Node interface
Browse files Browse the repository at this point in the history
  • Loading branch information
leej1012 committed Aug 16, 2024
1 parent d32b014 commit 6c8523a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ public ResponseBean getStakingAddressByNode(@RequestParam("public_key") @Length(
return nodesService.getStakingAddressByNode(publicKey);
}

@RequestLimit(count = 60)
@ApiOperation(value = "get max node date cycle")
@GetMapping(value = "/node-data-cycle")
public ResponseBean getMaxNodeDataCycle() {
return nodesService.getMaxNodeDataCycle();
}

@RequestLimit(count = 60)
@ApiOperation(value = "get bad nodes")
@GetMapping(value = "/bad-node")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
Expand All @@ -16,5 +17,5 @@ public interface NodeCycleMapper extends Mapper<NodeCycle> {

int selectNodeCycleCountByPublicKey(@Param("publicKey") String publicKey);


int selectMaxNodeCycle();
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,7 @@ public interface INodesService {

ResponseBean getStakingAddressByNode(String publicKey);

ResponseBean getMaxNodeDataCycle();

ResponseBean getBadNode(Integer cycle);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,12 @@ public ResponseBean getStakingAddressByNode(String publicKey) {
return new ResponseBean(ErrorInfo.SUCCESS.code(), ErrorInfo.SUCCESS.desc(), addressList);
}

@Override
public ResponseBean getMaxNodeDataCycle() {
int maxCycle = nodeCycleMapper.selectMaxNodeCycle();
return new ResponseBean(ErrorInfo.SUCCESS.code(), ErrorInfo.SUCCESS.desc(), maxCycle);
}

public ResponseBean getBadNode(Integer cycle) {
List<String> nodeList = badNodeMapper.selectBadNodeByCycle(cycle);
return new ResponseBean(ErrorInfo.SUCCESS.code(), ErrorInfo.SUCCESS.desc(), nodeList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@
where public_key = #{publicKey}
</select>

<select id="selectMaxNodeCycle" resultType="Integer">
SELECT MAX(cycle)
FROM tbl_node_cycle_data
</select>
</mapper>

0 comments on commit 6c8523a

Please sign in to comment.