From e8cc4b109742a760ecb61b41259f68a114e91015 Mon Sep 17 00:00:00 2001 From: chuzhongzai Date: Sun, 3 Nov 2024 15:02:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=89=93=E5=8C=85=E5=9B=BA?= =?UTF-8?q?=E4=BB=B6;=E6=B5=81=E9=87=8F=E5=80=8D=E7=8E=87=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=94=B9=E4=B8=BA2=E5=80=8D;=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?;=E6=9B=B4=E6=96=B0e=E7=AB=99=E6=90=9C=E7=B4=A2=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 1 + .../java/com/lion/lionwebsite/Dao/normal/SubMapper.java | 2 +- .../com/lion/lionwebsite/Service/LocalServiceImpl.java | 2 +- .../java/com/lion/lionwebsite/Service/QueryService.java | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index ce70337..5deb3b3 100644 --- a/pom.xml +++ b/pom.xml @@ -113,6 +113,7 @@ org.graalvm.buildtools native-maven-plugin + 0.10.3 lionwebsite diff --git a/src/main/java/com/lion/lionwebsite/Dao/normal/SubMapper.java b/src/main/java/com/lion/lionwebsite/Dao/normal/SubMapper.java index f62c1a1..f1c17dd 100644 --- a/src/main/java/com/lion/lionwebsite/Dao/normal/SubMapper.java +++ b/src/main/java/com/lion/lionwebsite/Dao/normal/SubMapper.java @@ -32,7 +32,7 @@ public interface SubMapper { @Insert("insert into sub_update_record (user, ip, UA, time, location) values (#{user}, #{ip}, #{UA}, #{time}, #{location})") void insertSubUpdateRecord(SubUpdateRecord subUpdateRecord); - @Select("select * from sub_update_record") + @Select("select * from sub_update_record order by time desc") ArrayList selectAllSubUpdateRecord(); @Delete("delete from sub_update_record where user=#{user}") diff --git a/src/main/java/com/lion/lionwebsite/Service/LocalServiceImpl.java b/src/main/java/com/lion/lionwebsite/Service/LocalServiceImpl.java index 9e601c8..8f8192e 100644 --- a/src/main/java/com/lion/lionwebsite/Service/LocalServiceImpl.java +++ b/src/main/java/com/lion/lionwebsite/Service/LocalServiceImpl.java @@ -106,7 +106,7 @@ public class LocalServiceImpl{ if (matcher.find()) { // 将匹配到的数字添加到列表中 float ratio = Float.parseFloat(matcher.group()); - if(ratio <= 1) { + if(ratio <= 2) { stringBuilder.append(node).append("\n"); continue; } diff --git a/src/main/java/com/lion/lionwebsite/Service/QueryService.java b/src/main/java/com/lion/lionwebsite/Service/QueryService.java index 694b22f..850ebb4 100644 --- a/src/main/java/com/lion/lionwebsite/Service/QueryService.java +++ b/src/main/java/com/lion/lionwebsite/Service/QueryService.java @@ -31,7 +31,7 @@ public class QueryService { public String query(String keyword, String prev, String next) { Response response = Response.generateResponse(); String result; - String param = "?f_search=" + keyword.replace(" ", "+"); + String param = "?f_search=" + keyword.replace(" ", "+") + "&f_sft=on&f_sfu=on&f_sfl=on"; if(prev != null) param += "&prev=" + prev; @@ -111,11 +111,12 @@ public class QueryService { } path = "https://ehgt.org/" + path; - try(ServletOutputStream outputStream = response.getOutputStream(); - FileInputStream inputStream = new FileInputStream(image.getAbsoluteFile())){ + try(ServletOutputStream outputStream = response.getOutputStream()){ new URI(path).toURL().openConnection().getInputStream().transferTo(new FileOutputStream(CachePath + fileName + suffix)); GalleryUtil.convertImg(CachePath + fileName + suffix, suffix); + FileInputStream inputStream = new FileInputStream(image.getAbsoluteFile()); //如果放到括号里,会导致图片未创建时创建文件流失败报错 outputStream.write(inputStream.readAllBytes()); + inputStream.close(); }catch (IOException | URISyntaxException e){ System.out.println(e.getMessage()); }