puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
cloud-server-competition/src/main/java/com/dsh/competition/util/JuHeUtil.java
@@ -17,23 +17,24 @@
    /**
     * 校验实名认证
     *
     * @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;