Ver Fonte

fix 新增ocr接口

Administrator há 3 anos atrás
pai
commit
d929ec7eaa

+ 4 - 4
boman-wechat/src/main/java/com/boman/wechat/controller/AppletLoginController.java

@@ -51,17 +51,17 @@ public class AppletLoginController {
         //https://api.weixin.qq.com/cv/ocr/idcard?type=MODE&img_url=ENCODE_URL&access_token=ACCESS_TOCKEN
         Map<String,String> map = new HashMap<>();
         try {
-            String encode = URLEncoder.encode("http://118.178.139.79:5002/statics/2021/09/15/1631688213171.jpeg", "utf-8");
-            map.put("img_url",encode);
+            String encode = URLEncoder.encode("http://118.178.139.79:5002/statics/2021/09/16/1631776710012.jpg", "utf-8");
+            map.put("img_url","http://118.178.139.79:5002/statics/2021/09/16/1631776710012.jpg");
             map.put("access_token",accessToken);
-            String s = HttpClientUtils.doPost("https://api.weixin.qq.com/cv/ocr/idcard?type=MODE&", map);
+            String s = HttpClientUtils.doPost("https://api.weixin.qq.com/cv/ocr/idcard?type=photo&img_url=http://118.178.139.79:5002/statics/2021/09/16/1631776710012.jpg" + "&access_token=" + accessToken,null);
             System.out.println(s);
         } catch (IOException e) {
             e.printStackTrace();
         }
         return null;
     }
-    private String getAccessToken(){
+    private static String getAccessToken(){
         String accessToken = "";
         try {
             accessToken = HttpClientUtils.doGet1("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxb9b83f3c86545690&secret=95adc6921a24a3c6cff55f2a1290f6f6");