Jelajahi Sumber

修改配置

y 2 tahun lalu
induk
melakukan
d17e4b77af

+ 3 - 3
src/main/java/com/ydtech/utils/baidu/AuthService.java

@@ -61,8 +61,8 @@ public class AuthService {
 //        String clientId = "MN5kwB9Qvi77eTKexMG69HH1";
 //        // 官网获取的 Secret Key 更新为你注册的
 //        String clientSecret = "LIZb0viMF5833zNHhhok3Kl1wqF9qWue";
-        String clientId = staticEnvironment.getProperty("clientId");
-        String clientSecret = staticEnvironment.getProperty("clientSecret");
+        String clientId = staticEnvironment.getProperty("baidu.clientId");
+        String clientSecret = staticEnvironment.getProperty("baidu.clientSecret");
 
         return getAuth(clientId, clientSecret);
     }
@@ -78,7 +78,7 @@ public class AuthService {
      */
     public static String getAuth(String ak, String sk) {
         // 获取token地址
-        String authHost = staticEnvironment.getProperty("authHost");
+        String authHost = staticEnvironment.getProperty("baidu.authHost");
         String getAccessTokenUrl = authHost
                 // 1. grant_type为固定参数
                 + "grant_type=client_credentials"

+ 2 - 2
src/main/java/com/ydtech/utils/baidu/Idcard.java

@@ -51,7 +51,7 @@ public class Idcard {
         String accessToken = AuthService.getAuth();
         Map<String, Object> ma = new HashMap<>();
         // 请求url
-        String url = staticEnvironment.getProperty("idcard");
+        String url = staticEnvironment.getProperty("baidu.idcard");
         try {
             String imgParam = URLEncoder.encode(imgs, "UTF-8");
             String param = "id_card_side=" + "front" + "&image=" + imgParam + "&detect_photo=true";
@@ -82,7 +82,7 @@ public class Idcard {
         //// 从redis中获取信息,redis保存时间是20天。
         String accessToken = AuthService.getAuth();
         // 请求url
-        String url = staticEnvironment.getProperty("idcard");
+        String url = staticEnvironment.getProperty("baidu.idcard");
         try {
             String imgParam = URLEncoder.encode(image, "UTF-8");
             String param = "id_card_side=" + idCardSide + "&image=" + imgParam + "&detect_photo=true";

+ 2 - 2
src/main/java/com/ydtech/utils/baidu/MultiObjectDetect.java

@@ -42,7 +42,7 @@ public class MultiObjectDetect {
         Map<String, Object> ma = new HashMap<>();
 
         // 请求url
-        String url = staticEnvironment.getProperty("vehicle");
+        String url = staticEnvironment.getProperty("baidu.vehicle");
         try {
             // 本地文件路径
             imgData = imgData.substring(imgData.indexOf(",") + 1);
@@ -93,7 +93,7 @@ public class MultiObjectDetect {
 
     public static JSONObject request(String images, String vehicleLicenseSide) {
         // 请求url
-        String url = staticEnvironment.getProperty("vehicle");
+        String url = staticEnvironment.getProperty("baidu.vehicle");
         try {
 
             images = images.substring(images.indexOf(",") + 1);

+ 6 - 5
src/main/resources/application-pre.yml

@@ -13,11 +13,12 @@ ZMToken: THIRDSCOuloft2020052818346904zmYBSXQYTQ
 ZMUrl: https://www.echinacoal.com/singlePlatform/
 
 #百度图片识别API
-clientId: xG9M8tSjNvYPwSTNavM0ELlD
-clientSecret: riYIRG67akE5FGVwnHE3dGBly5zmdS6t
-authHost: https://aip.baidubce.com/oauth/2.0/token?
-vehicle: https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license
-idcard: https://aip.baidubce.com/rest/2.0/ocr/v1/idcard
+baidu:
+  clientId: xG9M8tSjNvYPwSTNavM0ELlD
+  clientSecret: riYIRG67akE5FGVwnHE3dGBly5zmdS6t
+  authHost: https://aip.baidubce.com/oauth/2.0/token?
+  vehicle: https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license
+  idcard: https://aip.baidubce.com/rest/2.0/ocr/v1/idcard
 
 aly:
   cbit:

+ 6 - 5
src/main/resources/application-prod.yml

@@ -13,11 +13,12 @@ ZMToken: THIRDSCOuloft2020052818346904zmYBSXQYTQ
 ZMUrl: https://www.echinacoal.com/singlePlatform/
 
 #百度图片识别API
-clientId: xG9M8tSjNvYPwSTNavM0ELlD
-clientSecret: riYIRG67akE5FGVwnHE3dGBly5zmdS6t
-authHost: https://aip.baidubce.com/oauth/2.0/token?
-vehicle: https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license
-idcard: https://aip.baidubce.com/rest/2.0/ocr/v1/idcard
+baidu:
+  clientId: xG9M8tSjNvYPwSTNavM0ELlD
+  clientSecret: riYIRG67akE5FGVwnHE3dGBly5zmdS6t
+  authHost: https://aip.baidubce.com/oauth/2.0/token?
+  vehicle: https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license
+  idcard: https://aip.baidubce.com/rest/2.0/ocr/v1/idcard
 
 aly:
   cbit:

+ 6 - 5
src/main/resources/application-test.yml

@@ -15,11 +15,12 @@ ZMToken: THIRDSCOuloft2020052818346904zmYBSX
 ZMUrl: https://test.echinacoal.com/singlePlatform/
 
 #百度图片识别API
-clientId: xG9M8tSjNvYPwSTNavM0ELlD
-clientSecret: riYIRG67akE5FGVwnHE3dGBly5zmdS6t
-authHost: https://aip.baidubce.com/oauth/2.0/token?
-vehicle: https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license
-idcard: https://aip.baidubce.com/rest/2.0/ocr/v1/idcard
+baidu:
+  clientId: xG9M8tSjNvYPwSTNavM0ELlD
+  clientSecret: riYIRG67akE5FGVwnHE3dGBly5zmdS6t
+  authHost: https://aip.baidubce.com/oauth/2.0/token?
+  vehicle: https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license
+  idcard: https://aip.baidubce.com/rest/2.0/ocr/v1/idcard
 
 aly:
   cbit: