deason преди 2 години
родител
ревизия
780d05b9ca

+ 8 - 2
examcloud-starters/examcloud-face-verify-starter/src/main/java/cn/com/qmth/examcloud/starters/face/verify/service/impl/FaceVerifyServiceImpl.java

@@ -76,8 +76,14 @@ public class FaceVerifyServiceImpl implements FaceVerifyService {
         // image_type: URL、BASE64、FACE_TOKEN,其中“本地化部署API”不支持 URL 方式
         Map<String, String> imageData = new HashMap<>();
         if (ImageParmType.FILE_URL == image.type()) {
-            imageData.put("image_type", "URL");
-            imageData.put("image", image.value());
+            if (properties.getBaiduLocalEnabled()) {
+                String imageBase64 = CommonUtils.toBase64(image.value());
+                imageData.put("image", imageBase64);
+                imageData.put("image_type", "BASE64");
+            } else {
+                imageData.put("image_type", "URL");
+                imageData.put("image", image.value());
+            }
         } else if (ImageParmType.FACE_TOKEN == image.type()) {
             imageData.put("image_type", "FACE_TOKEN");
             imageData.put("image", image.value());