From 58b4f05348543774c43198421fff3f52dc63ec26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Mon, 12 Dec 2022 16:33:24 +0800 Subject: [PATCH] commit --- .../Interceptor/IsLoginInterceptor.java | 35 ++----------------- .../TouPiao/Controller/TouPiaoController.java | 6 ++-- .../FengHuang/TouPiao/Model/TouPiaoModel.java | 5 +++ 3 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/dsideal/FengHuang/Interceptor/IsLoginInterceptor.java b/src/main/java/com/dsideal/FengHuang/Interceptor/IsLoginInterceptor.java index bb21092..0fffca1 100644 --- a/src/main/java/com/dsideal/FengHuang/Interceptor/IsLoginInterceptor.java +++ b/src/main/java/com/dsideal/FengHuang/Interceptor/IsLoginInterceptor.java @@ -18,13 +18,6 @@ import java.util.Map; public class IsLoginInterceptor implements Interceptor { @Override public void intercept(Invocation inv) { -// //增加IP范围检查,在合法的范围内就放行即可 2022-12-09 -// boolean flag = CommonUtil.checkAllowIpAddress(inv.getController().getRequest()); -// if(flag) { -// inv.invoke(); -// return; -// } - //正常的登录验证逻辑代码 IsLoginInterface annotation = inv.getMethod().getAnnotation(IsLoginInterface.class); if (annotation != null) { @@ -41,32 +34,10 @@ public class IsLoginInterceptor implements Interceptor { inv.invoke(); } //1、读取cookie,获取所有本域下的配置值 - boolean isTrue; - + boolean isTrue = false; - if ((con.getCookie("toupiaoren_tel"))==null || (con.getCookie("person_id") == null) || (con.getCookie("bureau_id") == null) || - (con.getCookie("identity_id") == null || (con.getCookie("org_code") == null))) { - isTrue = false; - } else { - Map loginMap = new HashMap(); - loginMap.put("identity_id", con.getCookie("identity_id")); - loginMap.put("person_id", con.getCookie("person_id")); - loginMap.put("bureau_id", con.getCookie("bureau_id")); - loginMap.put("org_code", con.getCookie("org_code")); - //2、根据cookie中获取到的map,得到一个 share - String token = CommonUtil.Sign(loginMap, PropKit.get("CookieMd5SingPwd")); - //3、与cookie中的token进行对比 - if (token.equals(con.getCookie("token"))) { - isTrue = true; - } else { - //清空cookie - con.setCookie("bureau_id", null, 0, true); - con.setCookie("identity_id", null, 0, true); - con.setCookie("person_id", null, 0, true); - con.setCookie("org_code", null, 0, true); - con.setCookie("token", null, 0, true); - isTrue = false; - } + if ((con.getCookie("toupiaoren_tel")) != null || (con.getCookie("person_id") != null)) { + isTrue = true; } if (isTrue) { inv.invoke(); diff --git a/src/main/java/com/dsideal/FengHuang/TouPiao/Controller/TouPiaoController.java b/src/main/java/com/dsideal/FengHuang/TouPiao/Controller/TouPiaoController.java index 9fcae51..e403d02 100644 --- a/src/main/java/com/dsideal/FengHuang/TouPiao/Controller/TouPiaoController.java +++ b/src/main/java/com/dsideal/FengHuang/TouPiao/Controller/TouPiaoController.java @@ -32,12 +32,14 @@ public class TouPiaoController extends Controller { renderJson(CommonUtil.renderJsonForLayUI(list)); } + /* + http://10.10.11.124:9000/FengHuang/TouPiao/getTouPiaoRenInfo + */ @Before({GET.class}) @IsLoginInterface({}) public void getTouPiaoRenInfo() { String toupiaoren_tel = getCookie("toupiaoren_tel"); - String sql = "select * from t_toupiao_toupiaoren where toupiaoren_tel=?"; - List list = Db.find(sql, toupiaoren_tel); + List list = tm.getTouPiaoRenInfo(toupiaoren_tel); renderJson(CommonUtil.renderJsonForLayUI(list)); } } diff --git a/src/main/java/com/dsideal/FengHuang/TouPiao/Model/TouPiaoModel.java b/src/main/java/com/dsideal/FengHuang/TouPiao/Model/TouPiaoModel.java index 72afbba..fb920b4 100644 --- a/src/main/java/com/dsideal/FengHuang/TouPiao/Model/TouPiaoModel.java +++ b/src/main/java/com/dsideal/FengHuang/TouPiao/Model/TouPiaoModel.java @@ -21,4 +21,9 @@ public class TouPiaoModel { String sql = "select * from t_toupiao_houxuanren where houxuanren_type_id=?"; return Db.find(sql, type_id); } + + public List getTouPiaoRenInfo(String toupiaoren_tel) { + String sql = "select * from t_toupiao_toupiaoren where toupiaoren_tel=?"; + return Db.find(sql, toupiaoren_tel); + } } \ No newline at end of file