修复一处异常问题
This commit is contained in:
parent
22416227d8
commit
d4b8e58946
@ -13,6 +13,7 @@ import java.util.Set;
|
||||
|
||||
public class QQNumberManager {
|
||||
private static QQNumberManager manager;
|
||||
|
||||
private QQNumberManager() {
|
||||
|
||||
}
|
||||
@ -23,6 +24,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void addNumber(Long qq, boolean isGroup) {
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
return;
|
||||
@ -33,6 +35,7 @@ public class QQNumberManager {
|
||||
json.put("model", new JSONArray());
|
||||
RedisTools.set(qq, json.toJSONString());
|
||||
}
|
||||
|
||||
public List<Long> getNumber() {
|
||||
List<Long> list = new ArrayList<>();
|
||||
Jedis jedis = RedisTools.getRedis();
|
||||
@ -48,6 +51,7 @@ public class QQNumberManager {
|
||||
jedis.close();
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean addPower(Long qq, String power) {
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
JSONObject json = JSON.parseObject(RedisTools.get(qq));
|
||||
@ -58,6 +62,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<String> getPower(Long qq) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
@ -70,6 +75,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<String> getUseModel(long qq) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
@ -82,6 +88,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean delPower(Long qq, String power) {
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
JSONObject json = JSON.parseObject(RedisTools.get(qq));
|
||||
@ -92,6 +99,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean addUseModel(Long qq, Class<?> modelClass) {
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
JSONObject json = JSON.parseObject(RedisTools.get(qq));
|
||||
@ -102,6 +110,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean delUseModel(Long qq, Class<?> modelClass) {
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
JSONObject json = JSON.parseObject(RedisTools.get(qq));
|
||||
@ -112,6 +121,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isExistsPower(Long qq, String... power) {
|
||||
//1
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
@ -126,6 +136,7 @@ public class QQNumberManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isGroup(Long qq) {
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
JSONObject json = JSON.parseObject(RedisTools.get(qq));
|
||||
@ -133,12 +144,18 @@ public class QQNumberManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isUseModel(Long qq, Class<?> modelClass) {
|
||||
try {
|
||||
if (RedisTools.exists(qq, null)) {
|
||||
JSONObject json = JSON.parseObject(RedisTools.get(qq));
|
||||
JSONArray array = json.getJSONArray("model");
|
||||
return array.contains(modelClass.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.i("isUseModel", qq + " " + modelClass.getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user