diff --git a/src/main/java/com/yutou/tools/ToolsApplication.java b/src/main/java/com/yutou/tools/ToolsApplication.java index fb8452e..591a6b4 100644 --- a/src/main/java/com/yutou/tools/ToolsApplication.java +++ b/src/main/java/com/yutou/tools/ToolsApplication.java @@ -9,7 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ToolsApplication { - public static final String version="1.0.17"; + public static final String version="1.0.18"; public static void main(String[] args) { System.out.println("当前版本号:"+version); diff --git a/src/main/java/com/yutou/tools/web/userController.java b/src/main/java/com/yutou/tools/web/userController.java index f030953..188bfe7 100644 --- a/src/main/java/com/yutou/tools/web/userController.java +++ b/src/main/java/com/yutou/tools/web/userController.java @@ -124,8 +124,22 @@ public class userController { @RequestMapping(value = "/login/login.do", method = RequestMethod.POST) @ResponseBody - public String login(HttpServletResponse response, String code) { + public String login(HttpServletRequest request,HttpServletResponse response, String code) { JSONObject json = new JSONObject(); + String ip=Tools.getRemoteAddress(request); + if(RedisTools.get(ip)==null||"-999".equals(ip)){ + RedisTools.set(ip,"1",60); + }else{ + int i=Integer.parseInt(RedisTools.get(ip)); + if(i!=3){ + i++; + RedisTools.set(ip,i+"",60); + }else{ + json.put("code", -2); + json.put("msg", "请求频繁,请稍后再试"); + return json.toJSONString(); + } + } String secret= (String) ConfigTools.load(ConfigTools.DATA,"secret"); if(StringUtils.isEmpty(secret)){ secret= (String) ConfigTools.load(ConfigTools.DATA,"secret_tmp"); diff --git a/web/html/body/nas/bilidown.html b/web/html/body/nas/bilidown.html index 34f7165..fc73e80 100644 --- a/web/html/body/nas/bilidown.html +++ b/web/html/body/nas/bilidown.html @@ -32,7 +32,7 @@ $('#side').load("/html/body/nas/side.html"); $.get("/login/check.do", function (data) { let json = JSON.parse(data); - if (json.code != 0) { + if (json.code !== 0) { window.location.href = "/" } }) diff --git a/web/html/body/nas/music.html b/web/html/body/nas/music.html index 9d31081..d01b158 100644 --- a/web/html/body/nas/music.html +++ b/web/html/body/nas/music.html @@ -12,7 +12,7 @@