<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                demo使用步驟 1.修改配置文件 2.執行demo類中的main方法 一、配置文件 com.nlp.ctiddemo.config.CtidConfig ``` // 服務器地址 public static String serverUrl = "https://open.digitalcitizen.com.cn:7280/idauth"; // 應用id public static String appId = ""; // 應用密鑰 public static String appSecret = ""; // 應用加密密鑰 public static String key = ""; ``` 二、demo入口 com.nlp.ctiddemo.app.Demo 1.身份證2項信息demo ``` public static void runDemo() { VerifyService verifyService = new VerifyService(); String authMode = "0x40"; String name = ""; String number = ""; String apply = verifyService.apply(authMode, null); System.out.println("申請接口返回的數據:" + apply); CommonResponse applyResponse = JSON.parseObject(apply, CommonResponse.class); String bizSerialNum = (String) ((Map) applyResponse.getData()).get("bizSerialNum"); String request = verifyService.request(bizSerialNum, authMode, null, name, number); System.out.println("認證接口返回的數據:" + request); } ``` 2.人臉+身份證2項信息 ``` public static void runDemo2() { VerifyService verifyService = new VerifyService(); String authMode = "0x42"; String name = "; String number = ""; String photoData = ""; String apply = verifyService.apply(authMode, null); System.out.println("申請接口返回的數據:" + apply); CommonResponse applyResponse = JSON.parseObject(apply, CommonResponse.class); String bizSerialNum = (String) ((Map) applyResponse.getData()).get("bizSerialNum"); String request = verifyService.request(bizSerialNum, authMode, photoData, name, number); System.out.println("認證接口返回的數據:" + request); } ``` 三、接口調用服務方法 1.獲取token方法 com.nlp.ctiddemo.service.TokenService.getAccessToken() ``` public CommonResponse getAccessToken(String appId, String appSecret) { CommonResponse commonResponse = tokenMap.get(appId + appSecret); try { if (commonResponse != null) { Map<String, Object> data = (Map<String, Object>) commonResponse.getData(); Long expireTime = (Long) data.get("expireTime"); if (expireTime == null || expireTime < System.currentTimeMillis()) { commonResponse = null; } } } catch (Exception e) { commonResponse = null; } if (commonResponse != null) { return commonResponse; } Map<String, String> data = new HashMap<>(); data.put("appId", appId); data.put("appSecret", appSecret); String response = HttpUtil.post(CtidConfig.serverUrl + "/auth/getCode", JSON.toJSONString(data), null); commonResponse = JSON.parseObject(response, CommonResponse.class); if ("0".equals(commonResponse.getCode())) { tokenMap.put(appId + appSecret, commonResponse); } return commonResponse; } ``` 2.身份認證申請接口 com.nlp.ctiddemo.service.VerifyService.apply() ``` public String apply(String authMode, String deviceId) { String accessToken = tokenService.getAccessToken(); Map<String, String> headers = new HashMap<>(); headers.put("Authorization", accessToken); headers.put("appId", CtidConfig.appId); Map<String, String> body = new HashMap<>(); if (StringUtils.isNotBlank(deviceId)) { body.put("deviceId", deviceId); } String jsonData = JSON.toJSONString(body); String encryptString = AESUtil.encryptAES(jsonData, CtidConfig.key); String post = HttpUtil.post(CtidConfig.serverUrl + "/validateIdentity/apply/" + authMode, encryptString, headers); return AESUtil.decryptAES(post, CtidConfig.key); } ``` 3.身份認證請求接口 com.nlp.ctiddemo.service.VerifyService.request() ``` public String request(String bizSerialNum, String authMode, String photoData, String name, String number) { String accessToken = tokenService.getAccessToken(); Map<String, String> headers = new HashMap<>(); headers.put("Authorization", accessToken); headers.put("appId", CtidConfig.appId); Map<String, String> body = new HashMap<>(); body.put("bizSerialNum", bizSerialNum); body.put("authMode", authMode); body.put("name", name); body.put("number", number); if (StringUtils.isNotBlank(photoData)) { body.put("photoData", photoData); } String jsonData = JSON.toJSONString(body); String encryptString = AESUtil.encryptAES(jsonData, CtidConfig.key); String post = HttpUtil.post(CtidConfig.serverUrl + "/validateIdentity/request/" + authMode, encryptString, headers); return AESUtil.decryptAES(post, CtidConfig.key); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看