From 730b8f59c9d54ab30d343fce6f96fd1e96eefdd4 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 13 七月 2020 11:08:55 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/web/AuthController.java |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/common/web/AuthController.java b/src/main/java/com/zy/common/web/AuthController.java
index dc4dca3..51e204a 100644
--- a/src/main/java/com/zy/common/web/AuthController.java
+++ b/src/main/java/com/zy/common/web/AuthController.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.zy.common.CodeRes;
+import com.zy.common.entity.Parameter;
 import com.zy.common.model.PowerDto;
 import com.zy.common.model.enums.HtmlNavIconType;
 import com.zy.common.utils.RandomValidateCodeUtil;
@@ -48,6 +49,7 @@
     private RolePermissionService rolePermissionService;
 
     @RequestMapping("/login.action")
+    @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "鐧诲綍")
     public R loginAction(String mobile, String password){
         if (mobile.equals("super") && password.equals(Cools.md5(superPwd))) {
             Map<String, Object> res = new HashMap<>();
@@ -79,14 +81,29 @@
         return R.ok(res);
     }
 
+    @RequestMapping("/code/switch.action")
+    public R code() {
+        return R.ok().add(Parameter.get().getCodeSwitch());
+    }
+
     @RequestMapping("/code.action")
     public void code(@RequestParam String sd, HttpServletResponse response) {
         RandomValidateCodeUtil.getRandcode(sd, response);
     }
 
     @RequestMapping("/code.do")
-    public String codeDo(@RequestParam String sd) {
-        String code = RandomValidateCodeUtil.code.get(sd);
+    public String codeDo(@RequestParam String sd) throws Exception {
+        String code = null;
+        int time = 0;
+        while (time < 3000) {
+            code = RandomValidateCodeUtil.code.get(sd);
+            if (!Cools.isEmpty(code)){
+                break;
+            } else {
+                Thread.sleep(10);
+                time = time + 100;
+            }
+        }
         RandomValidateCodeUtil.code.remove(sd);
         return code;
     }
@@ -129,7 +146,7 @@
 
                     // 鏄惁鎷ユ湁鏌ョ湅鏉冮檺
                     if (getUserId() != 9527) {
-                        Resource view = resourceService.selectOne(new EntityWrapper<Resource>().eq("resource_id", resource.getId()).like("code", "view"));
+                        Resource view = resourceService.selectOne(new EntityWrapper<Resource>().eq("resource_id", resource.getId()).like("code", "#view"));
                         if (!Cools.isEmpty(view)){
                             RoleResource param = new RoleResource();
                             param.setResourceId(view.getId());
@@ -241,7 +258,7 @@
     }
 
     @RequestMapping("/power/auth")
-    @ManagerAuth
+    @ManagerAuth(memo = "鎺堟潈")
     @Transactional
     public R power(Long roleId, String powers){
         Role role = roleService.selectById(roleId);

--
Gitblit v1.9.1