From 33c83af353f8f8fda62658a0de9112802862a269 Mon Sep 17 00:00:00 2001 From: xiaoliuhu Date: Wed, 24 Apr 2024 22:11:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BC=98=E5=8C=96money=E8=82=A1=E7=A5=A8K?= =?UTF-8?q?=E7=BA=BF=E5=9B=BE1H=E5=92=8C1D=E5=8F=AA=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/stock/market/web/MoneyApiController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/stock/market/web/MoneyApiController.java b/src/main/java/cn/stock/market/web/MoneyApiController.java index b8f2936..6c0f604 100644 --- a/src/main/java/cn/stock/market/web/MoneyApiController.java +++ b/src/main/java/cn/stock/market/web/MoneyApiController.java @@ -678,13 +678,13 @@ public class MoneyApiController { if(StringUtils.equals("H",resolution)){ to = (long) (System.currentTimeMillis() / 1000); from = to - ( 60 * 60 ); - countback = 16; + countback = 60; request.setResolution("1"); }else if(StringUtils.equals("D",resolution)){ to = (long) (System.currentTimeMillis() / 1000); from = to - (24 * 60 * 60 ); - countback = 30; - request.setResolution("1"); + countback = 75; + request.setResolution("5"); }else if(StringUtils.equals("W",resolution)){ to = (long) (System.currentTimeMillis() / 1000); from = to - (10 * 24 * 60 * 60 ); @@ -754,6 +754,11 @@ public class MoneyApiController { //根据时间过滤,只留当天的数据 Date currentTime = new Date(); + //判断最后一条是不是当天的数据,如果不是,把最后一条的时间作为当天的时间 + long getTime = response.getT().get(response.getT().size() - 1) * 1000L; + if(!DateUtil.isSameDay(currentTime, new Date(getTime))){ + currentTime = new Date(getTime); + } int i = 0; for (Long time : response.getT()) { time = time * 1000;