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()); }