Pu Zhibing
昨天 0d87176a57e39c62d37490d95fb5c5f60a49a808
user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/RedisUtil.java
@@ -125,6 +125,47 @@
    }
    public boolean lock(String key){
        try {
            boolean b = lock(key,5);
            if(!b){
                int num1 = 1;
                while (num1 <= 10){
                    try {
                        Thread.sleep(3000);//等待3秒
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    b = lock(5);
                    if(b){
                        return true;
                    }else{
                        num1++;
                    }
                }
                return false;
            }
            return b;
        }catch (Exception e){
            e.printStackTrace();
            unlock();
        }
        return false;
    }
    /**
     * 获取redis锁
     * @param time
     * @return
     */
    public boolean lock(String key, int time){
        String uuid = UUID.randomUUID().toString();
        return lock(key, uuid, time);
    }
    /**
     * 获取redis锁
     * @param time