From e01fce2ebdd2bdba72682aa314656b57e68f211c Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 01 九月 2025 16:05:06 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/system/controller/LicenseCreatorController.java |   38 +++++++++++++++++++++++---------------
 src/main/java/com/zy/common/properties/SystemProperties.java         |    2 +-
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/zy/common/properties/SystemProperties.java b/src/main/java/com/zy/common/properties/SystemProperties.java
index ba6350b..a248063 100644
--- a/src/main/java/com/zy/common/properties/SystemProperties.java
+++ b/src/main/java/com/zy/common/properties/SystemProperties.java
@@ -63,7 +63,7 @@
 
     // 鐢熸垚婵�娲荤爜
     public static void main(String[] args) {
-        String timeStr = "2021-08-01 17:48:35";
+        String timeStr = "2025-09-26 08:00:00";
         Date exprTime = DateUtils.convert(timeStr);
         String code = AesUtils.encrypt(DateUtils.convert(exprTime, DateUtils.yyyyMMddHHmmss), SystemProperties.SALT);
         System.out.println("婵�娲荤爜锛�"+code);
diff --git a/src/main/java/com/zy/system/controller/LicenseCreatorController.java b/src/main/java/com/zy/system/controller/LicenseCreatorController.java
index da5701a..6b4d644 100644
--- a/src/main/java/com/zy/system/controller/LicenseCreatorController.java
+++ b/src/main/java/com/zy/system/controller/LicenseCreatorController.java
@@ -1,8 +1,12 @@
 package com.zy.system.controller;
 
 import com.core.annotations.ManagerAuth;
+import com.core.common.AesUtils;
 import com.core.common.Cools;
+import com.core.common.DateUtils;
 import com.core.common.R;
+import com.zy.common.properties.OSinfo;
+import com.zy.common.properties.SystemProperties;
 import com.zy.system.entity.license.*;
 import de.schlichtherle.license.LicenseContent;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -69,22 +73,26 @@
      */
     @RequestMapping(value = "/getLicenseDays")
     public R getLicenseDays() {
-        if (true){
-            return R.ok().add(0);
-        }
-        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);
+        // 鑾峰彇婵�娲荤爜
+        String activationCode = SystemProperties.getActivationCode(OSinfo.getOSname().getActivationCodePath());
+        if (!Cools.isEmpty(activationCode)) {
+            // 鑾峰彇鏈夋晥鏈�
+            String timeStr = AesUtils.decrypt(activationCode, SystemProperties.SALT);
+            if (null == timeStr) {
+                return R.error();
+            }
+            Date exprTime = DateUtils.convert(timeStr, DateUtils.yyyyMMddHHmmss);
+            if (new Date().getTime() < exprTime.getTime()) {
+                Date start = new Date();
+                Long starTime = start.getTime();
+                Long endTime = exprTime.getTime();
+                Long num = endTime - starTime;//鏃堕棿鎴崇浉宸殑姣鏁�
+                int day = (int) (num / 24 / 60 / 60 / 1000);
+                return R.ok().add(day);
+            }
+        }
+        return R.error();
     }
 
     @RequestMapping(value = "/updateLicense")

--
Gitblit v1.9.1