From c4c80503f82d42299bebbf4ebba4fc7e31f9a2f6 Mon Sep 17 00:00:00 2001 From: Himit_ZH <372347736@qq.com> Date: Sun, 25 Jul 2021 14:25:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=A3=E5=86=B3=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E5=85=B6=E5=AE=83oj=E6=AF=94=E8=B5=9B=E6=9C=AA?= =?UTF-8?q?=E8=83=BD=E6=8C=89=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hcode/hoj/controller/admin/FileController.java | 4 ++-- .../top/hcode/hoj/controller/oj/HomeController.java | 3 +-- .../hcode/hoj/service/impl/ScheduleServiceImpl.java | 11 +++++++++-- .../DataBackup/src/main/resources/banner.txt | 6 +++++- .../top/hcode/hoj/remoteJudge/task/Impl/HduJudge.java | 4 ++-- .../JudgeServer/src/main/resources/banner.txt | 6 +++++- hoj-vue/src/views/oj/status/SubmissionDetails.vue | 2 +- 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/FileController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/FileController.java index 0d129fd0..af657281 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/FileController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/FileController.java @@ -408,7 +408,7 @@ public class FileController { } } - private static final ThreadLocal threadLocal = new ThreadLocal() { + private static final ThreadLocal threadLocalTime = new ThreadLocal() { @Override protected SimpleDateFormat initialValue() { return new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); @@ -489,7 +489,7 @@ public class FileController { for (Judge judge : userSubmissionList) { String filePath = userDir + File.separator + cpIdMap.getOrDefault(judge.getCpid(), "null") - + "_(" + threadLocal.get().format(judge.getSubmitTime()) + ")"; + + "_(" + threadLocalTime.get().format(judge.getSubmitTime()) + ")"; // OI模式只取最后一次提交 if (!isACM) { diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java index 6ce1c0bf..82505d04 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java @@ -20,6 +20,7 @@ import top.hcode.hoj.utils.Constants; import top.hcode.hoj.utils.RedisUtils; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -95,8 +96,6 @@ public class HomeController { // 从redis获取比赛列表 contestsList = (ArrayList>) redisUtils.get(redisKey); - HashMap resp = new HashMap<>(); - return CommonResult.successResponse(contestsList,"获取其它OJ最近比赛列表成功"); } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java index 539f7cf8..d586525c 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java @@ -166,7 +166,14 @@ public class ScheduleServiceImpl implements ScheduleService { } } // 把比赛列表按照开始时间排序,方便查看 - contestsList.sort((o1, o2) -> (int) (((Date) o1.get("beginTime")).getTime() - ((Date) o2.get("beginTime")).getTime())); + contestsList.sort((o1, o2) -> { + + long beginTime1 = ((Date) o1.get("beginTime")).getTime(); + long beginTime2 = ((Date) o2.get("beginTime")).getTime(); + + return Long.compare(beginTime1, beginTime2); + }); + // 获取对应的redis key String redisKey = Constants.Schedule.RECENT_OTHER_CONTEST.getCode(); // 缓存时间一天 @@ -198,7 +205,7 @@ public class ScheduleServiceImpl implements ScheduleService { try { // 防止cf的频率限制 try { - TimeUnit.SECONDS.sleep(5); + TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/hoj-springboot/DataBackup/src/main/resources/banner.txt b/hoj-springboot/DataBackup/src/main/resources/banner.txt index d02428f4..d9e179ab 100644 --- a/hoj-springboot/DataBackup/src/main/resources/banner.txt +++ b/hoj-springboot/DataBackup/src/main/resources/banner.txt @@ -12,5 +12,9 @@ ${AnsiColor.BRIGHT_YELLOW} ' : | : ;' ; : .'| \ \ ', / ' : | / ; ' : ;/| | | ' ,/ ' | '/ : ; : / | | '` ,/ | | \ ; : ;--' | : / \ \ .' ; : .' | : .' -| ,/ \ \ .' `---` | ,.' | | ,' @Author Himit_ZH +| ,/ \ \ .' `---` | ,.' | | ,' '---' `---` '---' `----' + Hcode Online Judge(HOJ) - Backend + @Author Himit_ZH + ->Github<- https://www.github.com/HimitZH/HOJ + ->Gitee<- https://gitee.com/himitzh0730/hoj \ No newline at end of file diff --git a/hoj-springboot/JudgeServer/src/main/java/top/hcode/hoj/remoteJudge/task/Impl/HduJudge.java b/hoj-springboot/JudgeServer/src/main/java/top/hcode/hoj/remoteJudge/task/Impl/HduJudge.java index 0f3c5bb8..eeaa03da 100644 --- a/hoj-springboot/JudgeServer/src/main/java/top/hcode/hoj/remoteJudge/task/Impl/HduJudge.java +++ b/hoj-springboot/JudgeServer/src/main/java/top/hcode/hoj/remoteJudge/task/Impl/HduJudge.java @@ -27,8 +27,8 @@ public class HduJudge implements RemoteJudgeStrategy { public static Map headers = MapUtil .builder(new HashMap()) .put("Host", "acm.hdu.edu.cn") - .put("origin", "http://acm.hdu.edu.cn") - .put("referer", "http://acm.hdu.edu.cn") + .put("origin", "https://acm.hdu.edu.cn") + .put("referer", "https://acm.hdu.edu.cn") .put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36") .map(); diff --git a/hoj-springboot/JudgeServer/src/main/resources/banner.txt b/hoj-springboot/JudgeServer/src/main/resources/banner.txt index d02428f4..67256c1c 100644 --- a/hoj-springboot/JudgeServer/src/main/resources/banner.txt +++ b/hoj-springboot/JudgeServer/src/main/resources/banner.txt @@ -12,5 +12,9 @@ ${AnsiColor.BRIGHT_YELLOW} ' : | : ;' ; : .'| \ \ ', / ' : | / ; ' : ;/| | | ' ,/ ' | '/ : ; : / | | '` ,/ | | \ ; : ;--' | : / \ \ .' ; : .' | : .' -| ,/ \ \ .' `---` | ,.' | | ,' @Author Himit_ZH +| ,/ \ \ .' `---` | ,.' | | ,' '---' `---` '---' `----' + Hcode Online Judge(HOJ) - JudgeServer + @Author Himit_ZH + ->Github<- https://www.github.com/HimitZH/HOJ + ->Gitee<- https://gitee.com/himitzh0730/hoj \ No newline at end of file diff --git a/hoj-vue/src/views/oj/status/SubmissionDetails.vue b/hoj-vue/src/views/oj/status/SubmissionDetails.vue index 67501459..5fc2b2d2 100644 --- a/hoj-vue/src/views/oj/status/SubmissionDetails.vue +++ b/hoj-vue/src/views/oj/status/SubmissionDetails.vue @@ -173,7 +173,7 @@ isAdminRole " > - +