安久和疯体混服

master
duhui 2022-08-29 20:15:34 +08:00
parent 4411ef41b1
commit d875e2c443
3 changed files with 61 additions and 42 deletions

View File

@ -26,7 +26,7 @@ public class GetUserController extends HttpServlet {
private final static String _COLLECTION_NAME = "user_info";
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(){
//初始化所有需要的验证方式
serviceMap.put("MHT", new LdVerifyService("MHT"));

View File

@ -15,8 +15,9 @@ import java.util.HashMap;
import java.util.Map;
/**
*
* ,
*/
@Deprecated
public class AnJiuVerifyService extends AbstractVerifyService {
private static final Logger LOGGER = LoggerFactory.getLogger(AnJiuVerifyService.class);
public static int isTestLan=0;
@ -43,8 +44,7 @@ public class AnJiuVerifyService extends AbstractVerifyService {
return true;
}
// 渠道 登陆
if ("1".equals(platform) ) {
if ("4".equals(platform) ) {
//正式服appId
VerifyParams params = new VerifyParams();
params.setProductCode(appId);

View File

@ -2,10 +2,10 @@ package com.ljsd.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ljsd.controller.GetUserController;
import com.ljsd.pojo.VerifyParams;
import com.ljsd.util.AppConstans;
import com.ljsd.util.HttpUtils;
import com.ljsd.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -16,7 +16,7 @@ import java.util.HashMap;
import java.util.Map;
/**
* ohayoo
* ohayoo
*/
public class QuickVerifyService3 extends AbstractVerifyService {
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 ios_appId = "6485653972429833";
private final static String anJiu_appId = "220422817754";
public QuickVerifyService3(String sign) {
super(sign);
}
@ -42,38 +44,24 @@ public class QuickVerifyService3 extends AbstractVerifyService {
if (!result) {
response.sendError(400, "verify fail");
LOGGER.error("test verify fail");
return false;
}
return true;
return result;
}
// 渠道 登陆
if ("1".equals(platform) ) {
String sub_channel = request.getParameter("sub_channel");
boolean result = false;
if (sub_channel != null && !sub_channel.equals("")) {
if (sub_channel.equals("1000")) {
//测试服构建参数
// 疯体quick渠道登录
if ("1".equals(platform)) {
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);
}
}
VerifyParams testParam = getFormatParam(params,request, openId, token);
boolean result = doVerify(testParam);
if (!result) {
response.sendError(400, "verify fail");
LOGGER.error("verify fail");
response.sendError(400, "quick verify fail");
LOGGER.error("quick verify fail");
return false;
}
}
// 正式 ios
// ohayoo登录
if ("2".equals(platform) || "3".equals(platform)) {
String sub_channel = request.getParameter("sub_channel");
boolean result = false;
@ -87,11 +75,10 @@ public class QuickVerifyService3 extends AbstractVerifyService {
}
VerifyParams param;
// 1000是测试服
param = getFormatParam(params, request, openId, token);
if (sub_channel.equals("1000")) {
param = getTestParam(params,request, openId, token);
result = verifyTestIos(param);
} else {
param = getFormatParam(params,request, openId, token);
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){
e.printStackTrace();
}
@ -110,19 +110,23 @@ public class QuickVerifyService3 extends AbstractVerifyService {
@Override
public boolean verifyTest(VerifyParams params) {
return doVerify(params);
return false;
}
@Override
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) {
String url = "https://sandbox-sdk.ohayoo.cn/game_sdk/light_game/account/partner/check";
return doVerifyIos(params,url);
}
public boolean verifyFormatIos(VerifyParams params) {
String url = "https://ohayoo.cn/game_sdk/light_game/account/partner/check";
return doVerifyIos(params,url);
@ -130,7 +134,7 @@ public class QuickVerifyService3 extends AbstractVerifyService {
@Override
boolean doVerify(VerifyParams params) {
LOGGER.info("quick登录验证-->{}",params.getOpenId());
LOGGER.info("疯体 quick登录验证-->{}",params.getOpenId());
String url = "http://checkuser.quickapi.net/v2/checkUserInfo";
Map<String,String> parms = new HashMap<>();
parms.put("token",params.getToken());
@ -173,12 +177,27 @@ public class QuickVerifyService3 extends AbstractVerifyService {
return result;
}
@Override
protected VerifyParams getTestParam(VerifyParams params, HttpServletRequest request, String openId, String token) {
params.setChannel("QUICK");
params.setToken(token);
params.setOpenId(openId);
return params;
boolean doVerifyAnJiu(VerifyParams params) {
String url = "http://release.anjiu.cn/cp/checktoken";
Map<String,String> parms = new HashMap<>();
parms.put("sessionId",params.getToken());
parms.put("appId",params.getProductCode());
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