疯体ios登陆修改3

master
duhui 2022-07-13 10:40:00 +08:00
parent 68cdc31e62
commit 178af21e33
2 changed files with 22 additions and 17 deletions

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
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;
@ -146,23 +147,27 @@ public class QuickVerifyService3 extends AbstractVerifyService {
boolean doVerifyIos(VerifyParams params, String url) {
LOGGER.info("疯体 Ohayoo 登录验证-->{}",params.getOpenId());
Map<String,String> parms = new HashMap<>();
parms.put("app_id",params.getProductCode());
parms.put("token",params.getToken());
parms.put("open_id",params.getOpenId());
JSONObject jsonObject = new JSONObject();
jsonObject.put("token",params.getToken());
jsonObject.put("product_code",params.getProductCode());
jsonObject.put("uid",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");
String r = HttpUtils.sendPost(url, jsonObject);
LOGGER.info("疯体 Ohayoo 请求结果:{}",r);
if (StringUtils.checkIsEmpty(r)){
return false;
}
JSONObject resultJson = JSON.parseObject(r);
int status = resultJson.getIntValue("status");
if(status == 0){
result = true;
}
return result;
}

View File

@ -109,6 +109,7 @@ public class HttpUtils {
/**
* URL POST
*
@ -129,8 +130,8 @@ public class HttpUtils {
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
@ -172,5 +173,4 @@ public class HttpUtils {
}