deason %!s(int64=2) %!d(string=hai) anos
pai
achega
72354e66ea

+ 17 - 1
examcloud-starters/examcloud-face-verify-starter/src/main/java/cn/com/qmth/examcloud/starters/face/verify/model/faceplus/FacePlusApiHelper.java

@@ -23,6 +23,14 @@ public class FacePlusApiHelper {
     private final static Logger log = LoggerFactory.getLogger(FacePlusApiHelper.class);
 
     public static FaceResult faceDetect(FaceVerifyProperties properties, Map<String, String> params) {
+        if (StringUtils.isBlank(properties.getFacePlusKey())) {
+            throw new IllegalArgumentException("[FACE++] apiKey must be not empty.");
+        }
+
+        if (StringUtils.isBlank(properties.getFacePlusSecret())) {
+            throw new IllegalArgumentException("[FACE++] apiSecret must be not empty.");
+        }
+
         FormBody.Builder formBody = new FormBody.Builder();
         formBody.add("api_key", properties.getFacePlusKey());
         formBody.add("api_secret", properties.getFacePlusSecret());
@@ -77,6 +85,14 @@ public class FacePlusApiHelper {
     }
 
     public static FaceResult faceCompare(FaceVerifyProperties properties, Map<String, String> params) {
+        if (StringUtils.isBlank(properties.getFacePlusKey())) {
+            throw new IllegalArgumentException("[FACE++] apiKey must be not empty.");
+        }
+
+        if (StringUtils.isBlank(properties.getFacePlusSecret())) {
+            throw new IllegalArgumentException("[FACE++] apiSecret must be not empty.");
+        }
+
         FormBody.Builder formBody = new FormBody.Builder();
         formBody.add("api_key", properties.getFacePlusKey());
         formBody.add("api_secret", properties.getFacePlusSecret());
@@ -156,7 +172,7 @@ public class FacePlusApiHelper {
             }
 
             if (code == 413) {
-                // 客户发送的请求大小超过了2MB限制。该错误的返回格式为纯文本,不是json格式。
+                // 请求大小超过了2MB限制。该错误的返回格式为纯文本,不是json格式。
                 FacePlusResponse result = new FacePlusResponse();
                 result.setError_message("IMAGE_FILE_TOO_LARGE");
                 return result;