From ecad870fe1896c8c3e48506d50bb5818974253bf Mon Sep 17 00:00:00 2001 From: fangyuan <527392886@qq.com> Date: 星期一, 16 一月 2023 11:33:58 +0800 Subject: [PATCH] 机场公安前后端联调内容 --- ycl-platform/src/main/java/com/ycl/config/Intercept.java | 33 ++++++++++++++++----------------- 1 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ycl-platform/src/main/java/com/ycl/config/Intercept.java b/ycl-platform/src/main/java/com/ycl/config/Intercept.java index b6887d1..3391fea 100644 --- a/ycl-platform/src/main/java/com/ycl/config/Intercept.java +++ b/ycl-platform/src/main/java/com/ycl/config/Intercept.java @@ -21,32 +21,31 @@ public class Intercept implements HandlerInterceptor { @Resource - NewsAdminService newsAdminService; - @Resource NewsIpService newsIpService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { - List<String> ips = newsIpService.list().stream().map(item->item.getIpAddess()).collect(Collectors.toList()); - if (!ips.contains(request.getRemoteAddr())){ + List<String> ips = newsIpService.list().stream().map(item -> item.getIpAddess()).collect(Collectors.toList()); + if (!ips.contains(request.getRemoteAddr())) { return false; + } - String token = request.getHeader("token"); - JwtTokenUtil jwtTokenUtil = new JwtTokenUtil(); - if (token==null||token.isEmpty()){ +// String token = request.getHeader("token"); +// JwtTokenUtil jwtTokenUtil = new JwtTokenUtil(); +// if (token==null||token.isEmpty()){ // response.sendRedirect(""); // return true; - throw new ApiException("鐢ㄦ埛鏈櫥褰�"); - } - AuthInfo authInfo = jwtTokenUtil.parseToken(token); - if (authInfo == null) { - throw new ApiException("鏈璇佺敤鎴�"); - } - if (newsAdminService.getOne(new LambdaQueryWrapper<NewsAdmin>().eq(NewsAdmin::getUsername, authInfo.getUsername())) == null) { - throw new ApiException("涓嶆槸绯荤粺鐢ㄦ埛"); - } else { +// throw new ApiException("鐢ㄦ埛鏈櫥褰�"); +// } +// AuthInfo authInfo = jwtTokenUtil.parseToken(token); +// if (authInfo == null) { +// throw new ApiException("鏈璇佺敤鎴�"); +// } +// if (newsAdminService.getOne(new LambdaQueryWrapper<NewsAdmin>().eq(NewsAdmin::getUsername, authInfo.getUsername())) == null) { +// throw new ApiException("涓嶆槸绯荤粺鐢ㄦ埛"); +// } else { return true; - } +// } } -- Gitblit v1.8.0