|
|
@@ -28,27 +28,6 @@ public class AdminFilter extends AccessControlFilter {
|
|
|
throws Exception {
|
|
|
AftUser token = TokenManager.getToken();
|
|
|
if (token instanceof Admin) {
|
|
|
- //获取访问是post还是get
|
|
|
- boolean post = ((HttpServletRequest) request).getMethod().equals("POST");
|
|
|
- if(post){
|
|
|
- //获取接口名称
|
|
|
- String UrlName = ((HttpServletRequest) request).getRequestURI();
|
|
|
- String id = token.getId();
|
|
|
- String tokenTime = redisUtil.getString("tokenTime:"+id);
|
|
|
- if (tokenTime != null){
|
|
|
- //只限制post请求
|
|
|
- //判定接口相同时间小于1秒提示请勿重复提交
|
|
|
- String[] split = tokenTime.split("\\|");
|
|
|
- String s = split[0];
|
|
|
- if (UrlName.equals(s)){
|
|
|
- if (System.currentTimeMillis()-Long.valueOf(split[1])<1000){
|
|
|
- LoggerUtils.debug(CLASS, "请勿重复提交!");
|
|
|
- shiroFilterUtils.out((HttpServletResponse) response, new Result().error(new Error("请勿重复提交!")));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- redisUtil.setString("tokenTime:"+id,UrlName+"|"+System.currentTimeMillis());
|
|
|
- }
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
return Boolean.FALSE;
|