|
|
@@ -7,6 +7,8 @@ import com.ljsd.util.NetUtil;
|
|
|
import com.ljsd.util.StringUtils;
|
|
|
import com.mongodb.BasicDBObject;
|
|
|
import com.mongodb.DBObject;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.HttpServlet;
|
|
|
@@ -18,6 +20,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
public class GetServerListController extends HttpServlet {
|
|
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(GetServerListController.class);
|
|
|
private final static String _COLLECTION_NAME = "server_info";
|
|
|
//白名单
|
|
|
private final static String _WHITE_LIST = "white_user_list";
|
|
|
@@ -73,11 +76,11 @@ public class GetServerListController extends HttpServlet {
|
|
|
lastRefreshTime = local;
|
|
|
recommend = "";
|
|
|
|
|
|
- DBObject whiteListDBObject = new BasicDBObject();
|
|
|
- whiteListDBObject.put("openId", openId);
|
|
|
- List<DBObject> whiteList = BaseGlobal.getInstance().mongoDBPool.find(_WHITE_LIST, whiteListDBObject);
|
|
|
- List<DBObject> blackList = BaseGlobal.getInstance().mongoDBPool.find(_BLACK_LIST, whiteListDBObject);
|
|
|
-
|
|
|
+// DBObject whiteListDBObject = new BasicDBObject();
|
|
|
+// whiteListDBObject.put("openId", openId);
|
|
|
+ DBObject whiteList = BaseGlobal.getInstance().mongoDBPool.findOne(_WHITE_LIST, openId);
|
|
|
+ DBObject blackList = BaseGlobal.getInstance().mongoDBPool.findOne(_BLACK_LIST, openId);
|
|
|
+ LOGGER.info("whitelist ={}, blacklist={},openid={}",whiteList,blackList,openId);
|
|
|
String userip = NetUtil.getIpAddr(request);
|
|
|
DBObject whiteIPListDBObject = new BasicDBObject();
|
|
|
whiteIPListDBObject.put("ip", userip);
|
|
|
@@ -104,11 +107,11 @@ public class GetServerListController extends HttpServlet {
|
|
|
//server_version
|
|
|
// String server_version2 = serverInfo.get("server_version").toString();
|
|
|
int num = getOnlineNum(server_id);
|
|
|
- if (whiteList != null && whiteList.size() > 0 && (state == -1 || state == 1 || state == 0)) {
|
|
|
- state = 2;
|
|
|
+ if (whiteList != null && (state == -1 || state == 1 || state == 0)) {
|
|
|
+ state = 0;
|
|
|
} else if (ipList != null && ipList.size() > 0 && (state == -1 || state == 1 || state == 0)) {
|
|
|
state = 2;
|
|
|
- } else if (blackList != null && blackList.size() > 0) {
|
|
|
+ } else if (blackList != null) {
|
|
|
state = 1;
|
|
|
} else {
|
|
|
if (state == 5) {
|
|
|
@@ -122,7 +125,7 @@ public class GetServerListController extends HttpServlet {
|
|
|
if (state == -1) {
|
|
|
continue;
|
|
|
}
|
|
|
- if (System.currentTimeMillis()/1000 < time && whiteList.size() == 0) {
|
|
|
+ if (System.currentTimeMillis()/1000 < time) {
|
|
|
continue;
|
|
|
}
|
|
|
if (state == 2 && maxNum < num) {
|