diff --git a/src/main/java/com/ljsd/service/QuickVerifyService3.java b/src/main/java/com/ljsd/service/QuickVerifyService3.java index 893e248..bb94479 100644 --- a/src/main/java/com/ljsd/service/QuickVerifyService3.java +++ b/src/main/java/com/ljsd/service/QuickVerifyService3.java @@ -1,5 +1,7 @@ package com.ljsd.service; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.ljsd.pojo.VerifyParams; import com.ljsd.util.AppConstans; import com.ljsd.util.HttpUtils; @@ -20,6 +22,8 @@ public class QuickVerifyService3 extends AbstractVerifyService { public static int isTestLan=0; private final static String product_code = "59089882210126220068309806520046"; + private final static String iosAppId = "6485653974664449"; + public QuickVerifyService3(String sign) { super(sign); } @@ -38,7 +42,11 @@ public class QuickVerifyService3 extends AbstractVerifyService { LOGGER.error("test verify fail"); return false; } - } else if (!"3".equals(platform) ) {//正式 切不是pc + return true; + } + + // 正式 安卓 + if ("1".equals(platform) ) { String sub_channel = request.getParameter("sub_channel"); boolean result = false; if (sub_channel != null && !sub_channel.equals("")) { @@ -48,9 +56,6 @@ public class QuickVerifyService3 extends AbstractVerifyService { params.setProductCode(product_code); VerifyParams testParam = getTestParam(params,request, openId, token); result = verifyTest(testParam); - } else if(sub_channel.equals("20201222")){ - //商务服 - //result = loginVerfifyShangwu("MHT", openId, token, MHTSDKConstans.rhappIdshangwu); } else { //正式服appId 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){ e.printStackTrace(); } @@ -104,6 +123,29 @@ public class QuickVerifyService3 extends AbstractVerifyService { return result; } + boolean doVerifyIos(VerifyParams params) { + LOGGER.info("疯体 Ohayoo 登录验证-->{}",params.getOpenId()); + String url = "https://ohayoo.cn/game_sdk/light_game/account/partner/check"; + Map 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 protected VerifyParams getTestParam(VerifyParams params, HttpServletRequest request, String openId, String token) { params.setChannel("QUICK");