package com.dsh.account.util;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONObject;
|
import com.dsh.account.util.httpClinet.HttpClientUtil;
|
import com.dsh.account.util.httpClinet.HttpResult;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
* @author zhibing.pu
|
* @date 2023/7/11 12:05
|
*/
|
public class JuHeUtil {
|
|
|
/**
|
* 校验实名认证
|
*
|
* @param idcard
|
* @param name
|
* @return
|
* @throws Exception
|
*/
|
public static Boolean idcardAuthentication(String idcard, String name) throws Exception {
|
Map<String, Object> params = new HashMap<>();
|
params.put("idcard", idcard);
|
params.put("realname", name);
|
params.put("key", "29fec4bbe3108e4fbf52704e5a906fe0");
|
HttpResult httpResult = HttpClientUtil.pushHttpRequset("POST", "http://op.juhe.cn/idcard/query", params, null, "form");
|
if (httpResult.getCode() != 200) {
|
return false;
|
}
|
JSONObject jsonObject = JSON.parseObject(httpResult.getData());
|
Integer error_code = jsonObject.getInteger("error_code");
|
if (0 == error_code) {
|
JSONObject result = jsonObject.getJSONObject("result");
|
Integer res = result.getInteger("res");
|
return res == 1 ? true : false;
|
}
|
return false;
|
}
|
|
}
|