generated from root/miduo_server
安久和疯体混服
parent
4411ef41b1
commit
d875e2c443
|
|
@ -26,7 +26,7 @@ public class GetUserController extends HttpServlet {
|
||||||
private final static String _COLLECTION_NAME = "user_info";
|
private final static String _COLLECTION_NAME = "user_info";
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(GetUserController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(GetUserController.class);
|
||||||
|
|
||||||
private static Map<String, VerifyService> serviceMap = new HashMap<>();
|
public static Map<String, VerifyService> serviceMap = new HashMap<>();
|
||||||
public static void initHandler(){
|
public static void initHandler(){
|
||||||
//初始化所有需要的验证方式
|
//初始化所有需要的验证方式
|
||||||
serviceMap.put("MHT", new LdVerifyService("MHT"));
|
serviceMap.put("MHT", new LdVerifyService("MHT"));
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,9 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安久渠道
|
* 安久渠道,和疯体混服了,所以不用这个文件了
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class AnJiuVerifyService extends AbstractVerifyService {
|
public class AnJiuVerifyService extends AbstractVerifyService {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(AnJiuVerifyService.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(AnJiuVerifyService.class);
|
||||||
public static int isTestLan=0;
|
public static int isTestLan=0;
|
||||||
|
|
@ -43,8 +44,7 @@ public class AnJiuVerifyService extends AbstractVerifyService {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 渠道 登陆
|
if ("4".equals(platform) ) {
|
||||||
if ("1".equals(platform) ) {
|
|
||||||
//正式服appId
|
//正式服appId
|
||||||
VerifyParams params = new VerifyParams();
|
VerifyParams params = new VerifyParams();
|
||||||
params.setProductCode(appId);
|
params.setProductCode(appId);
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ package com.ljsd.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ljsd.controller.GetUserController;
|
||||||
import com.ljsd.pojo.VerifyParams;
|
import com.ljsd.pojo.VerifyParams;
|
||||||
import com.ljsd.util.AppConstans;
|
import com.ljsd.util.AppConstans;
|
||||||
import com.ljsd.util.HttpUtils;
|
import com.ljsd.util.HttpUtils;
|
||||||
import com.ljsd.util.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 疯体渠道,ohayoo
|
* 疯体渠道,ohayoo,安久混服
|
||||||
*/
|
*/
|
||||||
public class QuickVerifyService3 extends AbstractVerifyService {
|
public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractVerifyService.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractVerifyService.class);
|
||||||
|
|
@ -26,6 +26,8 @@ public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
private final static String android_appId = "6485653971822594";
|
private final static String android_appId = "6485653971822594";
|
||||||
private final static String ios_appId = "6485653972429833";
|
private final static String ios_appId = "6485653972429833";
|
||||||
|
|
||||||
|
private final static String anJiu_appId = "220422817754";
|
||||||
|
|
||||||
public QuickVerifyService3(String sign) {
|
public QuickVerifyService3(String sign) {
|
||||||
super(sign);
|
super(sign);
|
||||||
}
|
}
|
||||||
|
|
@ -42,38 +44,24 @@ public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
response.sendError(400, "verify fail");
|
response.sendError(400, "verify fail");
|
||||||
LOGGER.error("test verify fail");
|
LOGGER.error("test verify fail");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 渠道 登陆
|
// 疯体quick渠道登录
|
||||||
if ("1".equals(platform) ) {
|
if ("1".equals(platform)) {
|
||||||
String sub_channel = request.getParameter("sub_channel");
|
VerifyParams params = new VerifyParams();
|
||||||
boolean result = false;
|
params.setProductCode(quick_appId);
|
||||||
if (sub_channel != null && !sub_channel.equals("")) {
|
VerifyParams testParam = getFormatParam(params,request, openId, token);
|
||||||
if (sub_channel.equals("1000")) {
|
boolean result = doVerify(testParam);
|
||||||
//测试服构建参数
|
|
||||||
VerifyParams params = new VerifyParams();
|
|
||||||
params.setProductCode(quick_appId);
|
|
||||||
VerifyParams testParam = getTestParam(params,request, openId, token);
|
|
||||||
result = verifyTest(testParam);
|
|
||||||
} else {
|
|
||||||
//正式服appId
|
|
||||||
VerifyParams params = new VerifyParams();
|
|
||||||
params.setProductCode(quick_appId);
|
|
||||||
VerifyParams formatParam = getFormatParam(params,request, openId, token);
|
|
||||||
result = verifyFormat(formatParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
response.sendError(400, "verify fail");
|
response.sendError(400, "quick verify fail");
|
||||||
LOGGER.error("verify fail");
|
LOGGER.error("quick verify fail");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 正式 ios
|
// ohayoo登录
|
||||||
if ("2".equals(platform) || "3".equals(platform)) {
|
if ("2".equals(platform) || "3".equals(platform)) {
|
||||||
String sub_channel = request.getParameter("sub_channel");
|
String sub_channel = request.getParameter("sub_channel");
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
@ -87,11 +75,10 @@ public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
}
|
}
|
||||||
VerifyParams param;
|
VerifyParams param;
|
||||||
// 1000是测试服
|
// 1000是测试服
|
||||||
|
param = getFormatParam(params, request, openId, token);
|
||||||
if (sub_channel.equals("1000")) {
|
if (sub_channel.equals("1000")) {
|
||||||
param = getTestParam(params,request, openId, token);
|
|
||||||
result = verifyTestIos(param);
|
result = verifyTestIos(param);
|
||||||
} else {
|
} else {
|
||||||
param = getFormatParam(params,request, openId, token);
|
|
||||||
result = verifyFormatIos(param);
|
result = verifyFormatIos(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -102,6 +89,19 @@ public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 安久登录
|
||||||
|
if ("4".equals(platform)) {
|
||||||
|
VerifyParams params = new VerifyParams();
|
||||||
|
params.setProductCode(anJiu_appId);
|
||||||
|
VerifyParams formatParam = getFormatParam(params, request, pid, token);
|
||||||
|
boolean result = doVerifyAnJiu(formatParam);
|
||||||
|
if (!result) {
|
||||||
|
response.sendError(400, "anjiu verify fail");
|
||||||
|
LOGGER.error("anjiu verify fail");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
@ -110,19 +110,23 @@ public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean verifyTest(VerifyParams params) {
|
public boolean verifyTest(VerifyParams params) {
|
||||||
return doVerify(params);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean verifyFormat(VerifyParams params) {
|
public boolean verifyFormat(VerifyParams params) {
|
||||||
return doVerify(params);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected VerifyParams getTestParam(VerifyParams params, HttpServletRequest request, String openId, String token) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean verifyTestIos(VerifyParams params) {
|
public boolean verifyTestIos(VerifyParams params) {
|
||||||
String url = "https://sandbox-sdk.ohayoo.cn/game_sdk/light_game/account/partner/check";
|
String url = "https://sandbox-sdk.ohayoo.cn/game_sdk/light_game/account/partner/check";
|
||||||
return doVerifyIos(params,url);
|
return doVerifyIos(params,url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean verifyFormatIos(VerifyParams params) {
|
public boolean verifyFormatIos(VerifyParams params) {
|
||||||
String url = "https://ohayoo.cn/game_sdk/light_game/account/partner/check";
|
String url = "https://ohayoo.cn/game_sdk/light_game/account/partner/check";
|
||||||
return doVerifyIos(params,url);
|
return doVerifyIos(params,url);
|
||||||
|
|
@ -130,7 +134,7 @@ public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean doVerify(VerifyParams params) {
|
boolean doVerify(VerifyParams params) {
|
||||||
LOGGER.info("quick登录验证-->{}",params.getOpenId());
|
LOGGER.info("疯体 quick登录验证-->{}",params.getOpenId());
|
||||||
String url = "http://checkuser.quickapi.net/v2/checkUserInfo";
|
String url = "http://checkuser.quickapi.net/v2/checkUserInfo";
|
||||||
Map<String,String> parms = new HashMap<>();
|
Map<String,String> parms = new HashMap<>();
|
||||||
parms.put("token",params.getToken());
|
parms.put("token",params.getToken());
|
||||||
|
|
@ -173,12 +177,27 @@ public class QuickVerifyService3 extends AbstractVerifyService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
boolean doVerifyAnJiu(VerifyParams params) {
|
||||||
protected VerifyParams getTestParam(VerifyParams params, HttpServletRequest request, String openId, String token) {
|
String url = "http://release.anjiu.cn/cp/checktoken";
|
||||||
params.setChannel("QUICK");
|
Map<String,String> parms = new HashMap<>();
|
||||||
params.setToken(token);
|
parms.put("sessionId",params.getToken());
|
||||||
params.setOpenId(openId);
|
parms.put("appId",params.getProductCode());
|
||||||
return params;
|
parms.put("platformId",params.getOpenId());
|
||||||
|
LOGGER.info("安久请求参数,url:{},param:{}",url,params);
|
||||||
|
boolean result = false;
|
||||||
|
try {
|
||||||
|
String r = HttpUtils.doPost(url, parms);
|
||||||
|
LOGGER.info("anjiu请求结果:{}",r);
|
||||||
|
JSONObject jsonObject = JSON.parseObject(r);
|
||||||
|
int code = jsonObject.getIntValue("code");
|
||||||
|
if(code == 0){
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}catch (IOException e){
|
||||||
|
LOGGER.error("anjiu验证失败,Exception:{}",e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue