| | |
| | | |
| | | /** |
| | | * 校验实名认证 |
| | | * |
| | | * @param idcard |
| | | * @param name |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Boolean idcardAuthentication(String idcard, String name) 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){ |
| | | if (httpResult.getCode() != 200) { |
| | | return false; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Integer error_code = jsonObject.getInteger("error_code"); |
| | | if(0 == error_code){ |
| | | if (0 == error_code) { |
| | | JSONObject result = jsonObject.getJSONObject("result"); |
| | | Integer res = result.getInteger("res"); |
| | | return res == 1 ? true : false; |