From 2790d2558ef656ccddb4dbc94409decc8d227a1e Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期四, 05 九月 2024 10:10:02 +0800 Subject: [PATCH] #许可证 --- src/main/java/com/zy/system/controller/LicenseCreatorController.java | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zy/system/controller/LicenseCreatorController.java b/src/main/java/com/zy/system/controller/LicenseCreatorController.java index 0aafb3b..6d0c904 100644 --- a/src/main/java/com/zy/system/controller/LicenseCreatorController.java +++ b/src/main/java/com/zy/system/controller/LicenseCreatorController.java @@ -3,6 +3,7 @@ import com.core.common.Cools; import com.core.common.R; import com.zy.system.entity.license.*; +import com.zy.system.timer.LicenseTimer; import de.schlichtherle.license.LicenseContent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -29,7 +30,8 @@ @Autowired private LicenseCheckListener licenseCheckListener; - + @Autowired + private LicenseTimer licenseTimer; /** * 鑾峰彇鏈嶅姟鍣ㄧ‖浠朵俊鎭� * @param osName 鎿嶄綔绯荤粺绫诲瀷锛屽鏋滀负绌哄垯鑷姩鍒ゆ柇 @@ -61,19 +63,7 @@ */ @RequestMapping(value = "/getLicenseDays") public R getLicenseDays() { - LicenseVerify licenseVerify = new LicenseVerify(); - LicenseContent verifyInfo = licenseVerify.getVerifyInfo(); - if (verifyInfo == null) { - return R.error(); - } - - Date start = new Date(); - Date end = verifyInfo.getNotAfter(); - Long starTime = start.getTime(); - Long endTime = end.getTime(); - Long num = endTime - starTime;//鏃堕棿鎴崇浉宸殑姣鏁� - int day = (int) (num / 24 / 60 / 60 / 1000); - return R.ok().add(day); + return R.ok(licenseTimer.getLicenseDays()); } @RequestMapping(value = "/updateLicense") -- Gitblit v1.9.1