generated from root/miduo_server
增加quick登录验证
parent
240ac95690
commit
b949d0516e
|
@ -74,6 +74,17 @@ public class LoginSDKController extends HttpServlet {
|
|||
DBObject dbObject = new BasicDBObject();
|
||||
dbObject.put("_id", openId);
|
||||
List<DBObject> userInfos = BaseGlobal.mongoDBPool.find(MongoKey.USER_INFO, dbObject);
|
||||
//quick验证
|
||||
if(channel != null && channel.startsWith("Quick")){
|
||||
if(!KSManager.quickLoginVerify(openId, sessionId)){
|
||||
resp.put("result", 1);
|
||||
resp.put("error", "verify error !!");
|
||||
out.print(resp);
|
||||
out.flush();
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
//悠谷验证
|
||||
if (!KSManager.ygLoginVerify(openId, sessionId)) {
|
||||
resp.put("result", 1);
|
||||
resp.put("error", "verify error !!");
|
||||
|
@ -81,6 +92,7 @@ public class LoginSDKController extends HttpServlet {
|
|||
out.flush();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (userInfos.size() == 0) {
|
||||
BaseGlobal.mongoDBPool.save(MongoKey.USER_INFO, dbObject);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.ljsd.sdk;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ljsd.controller.LoginSDKController;
|
||||
import com.ljsd.util.BaseGlobal;
|
||||
import com.ljsd.util.HttpClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -41,6 +41,9 @@ public class KSManager {
|
|||
|
||||
public static String OPEN_SERVER_STRATEGY = "1"; // 开服策略:1 按注册量开 2 按时间开
|
||||
|
||||
private static String QUICK_LOGIN_VERIFY_URL = "http://checkuser.quickapi.net/v2/checkUserInfo";
|
||||
public final static String product_code = "32693415682925981428590879878901 ";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -136,4 +139,32 @@ public class KSManager {
|
|||
LOGGER.info("x7LoginVerify=====result={} json={}", result, json);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static boolean quickLoginVerify(String gameId, String token) {
|
||||
boolean isOnline = Boolean.parseBoolean(BaseGlobal.properties.getProperty("isOnline"));
|
||||
if (!isOnline){
|
||||
return true;
|
||||
}
|
||||
Map<String, String> param = new HashMap<>(2);
|
||||
param.put("uid", gameId);
|
||||
param.put("token", token);
|
||||
LOGGER.info("quick 登录验证-->{}",gameId);
|
||||
Map<String,String> parms = new HashMap<>();
|
||||
parms.put("token",token);
|
||||
parms.put("product_code", product_code);
|
||||
parms.put("uid",gameId);
|
||||
String paramStr = HttpClient.joinParam(param);
|
||||
boolean result = false;
|
||||
try {
|
||||
String r = HttpClient.sendGet(QUICK_LOGIN_VERIFY_URL, paramStr);
|
||||
LOGGER.info("quick 请求结果:{}",r);
|
||||
if (r != null && r.equals("1")) {
|
||||
result = true;
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.info("quick 验证失败,IOException:{}",e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue