From ec15fa6b3bcca977c64ff324145625e5d7ab8ed9 Mon Sep 17 00:00:00 2001
From: L <L@123>
Date: 星期三, 08 十月 2025 09:53:25 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/common/config/AdminInterceptor.java | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/common/config/AdminInterceptor.java b/src/main/java/com/zy/common/config/AdminInterceptor.java
index b42a596..ec0a1b9 100644
--- a/src/main/java/com/zy/common/config/AdminInterceptor.java
+++ b/src/main/java/com/zy/common/config/AdminInterceptor.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.annotations.AppAuth;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
@@ -53,8 +54,8 @@
String deToken = Cools.deTokn(token, superPwd);
if (deToken!=null){
long timestamp = Long.parseLong(deToken.substring(0, 13));
- // 1澶╁悗杩囨湡
- if (System.currentTimeMillis() - timestamp > 86400000){
+ // 鍗婂皬鏃跺悗杩囨湡
+ if (System.currentTimeMillis() - timestamp > 1000 * 60 * 30){
Http.response(response, BaseRes.DENIED);
return false;
}
@@ -73,6 +74,12 @@
// response.setHeader("Access-Control-Allow-Origin", "*");
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
+ if (method.isAnnotationPresent(AppAuth.class)){
+ AppAuth annotation = method.getAnnotation(AppAuth.class);
+ if (annotation.value().equals(AppAuth.Auth.CHECK)){
+ request.setAttribute("appAuth", annotation.memo());
+ }
+ }
if (method.isAnnotationPresent(ManagerAuth.class)){
ManagerAuth annotation = method.getAnnotation(ManagerAuth.class);
if (annotation.value().equals(ManagerAuth.Auth.CHECK)){
@@ -92,6 +99,11 @@
}
}
+ @Override
+ public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
+// Object r = request.getAttribute("cool-response");
+ }
+
private boolean check(HttpServletRequest request, HttpServletResponse response, String memo) {
try {
String token = request.getHeader("token");
--
Gitblit v1.9.1