疯体ios登陆

master
duhui 2022-07-12 15:40:31 +08:00
parent 9328cd5fe9
commit 4c2b1fcb65
1 changed files with 46 additions and 4 deletions

View File

@ -1,5 +1,7 @@
package com.ljsd.service; package com.ljsd.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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;
@ -20,6 +22,8 @@ public class QuickVerifyService3 extends AbstractVerifyService {
public static int isTestLan=0; public static int isTestLan=0;
private final static String product_code = "59089882210126220068309806520046"; private final static String product_code = "59089882210126220068309806520046";
private final static String iosAppId = "6485653974664449";
public QuickVerifyService3(String sign) { public QuickVerifyService3(String sign) {
super(sign); super(sign);
} }
@ -38,7 +42,11 @@ public class QuickVerifyService3 extends AbstractVerifyService {
LOGGER.error("test verify fail"); LOGGER.error("test verify fail");
return false; return false;
} }
} else if (!"3".equals(platform) ) {//正式 切不是pc return true;
}
// 正式 安卓
if ("1".equals(platform) ) {
String sub_channel = request.getParameter("sub_channel"); String sub_channel = request.getParameter("sub_channel");
boolean result = false; boolean result = false;
if (sub_channel != null && !sub_channel.equals("")) { if (sub_channel != null && !sub_channel.equals("")) {
@ -48,9 +56,6 @@ public class QuickVerifyService3 extends AbstractVerifyService {
params.setProductCode(product_code); params.setProductCode(product_code);
VerifyParams testParam = getTestParam(params,request, openId, token); VerifyParams testParam = getTestParam(params,request, openId, token);
result = verifyTest(testParam); result = verifyTest(testParam);
} else if(sub_channel.equals("20201222")){
//商务服
//result = loginVerfifyShangwu("MHT", openId, token, MHTSDKConstans.rhappIdshangwu);
} else { } else {
//正式服appId //正式服appId
VerifyParams params = new VerifyParams(); VerifyParams params = new VerifyParams();
@ -66,6 +71,20 @@ public class QuickVerifyService3 extends AbstractVerifyService {
} }
} }
// 正式 ios
if ("2".equals(platform) ) {
//测试服构建参数
VerifyParams params = new VerifyParams();
params.setProductCode(iosAppId);
VerifyParams testParam = getFormatParam(params,request, openId, token);
boolean result = doVerifyIos(testParam);
if (!result) {
response.sendError(400, "ios verify fail");
LOGGER.error("ios verify fail");
return false;
}
}
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
@ -104,6 +123,29 @@ public class QuickVerifyService3 extends AbstractVerifyService {
return result; return result;
} }
boolean doVerifyIos(VerifyParams params) {
LOGGER.info("疯体 Ohayoo 登录验证-->{}",params.getOpenId());
String url = "https://ohayoo.cn/game_sdk/light_game/account/partner/check";
Map<String,String> parms = new HashMap<>();
parms.put("app_id",params.getProductCode());
parms.put("token",params.getToken());
parms.put("open_id",params.getOpenId());
boolean result = false;
try {
String r = HttpUtils.doPost(url, parms);
LOGGER.info("疯体 Ohayoo 请求结果:{}",r);
JSONObject jsonObject = JSON.parseObject(r);
int status = jsonObject.getIntValue("status");
if(status == 0){
result = true;
}
}catch (IOException e){
LOGGER.info("疯体 Ohayoo 验证失败,IOException");
return false;
}
return result;
}
@Override @Override
protected VerifyParams getTestParam(VerifyParams params, HttpServletRequest request, String openId, String token) { protected VerifyParams getTestParam(VerifyParams params, HttpServletRequest request, String openId, String token) {
params.setChannel("QUICK"); params.setChannel("QUICK");