Bladeren bron

恢复开考时人脸识别限流

deason 2 jaren geleden
bovenliggende
commit
c1c99bc94d

+ 8 - 8
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/ExamCaptureController.java

@@ -85,14 +85,14 @@ public class ExamCaptureController extends ControllerSupport {
         }
         fileUrl = UrlUtil.decode(fileUrl);
 
-        // if (this.isFaceApiLimitSeconds(user.getKey())) {
-        //     log.error("compareFaceSync outOfLimitSeconds...");
-        //     throw new StatusException("500503", "人脸验证太频繁,请稍后重试!");
-        // }
-        // if (this.isFaceApiLimitMinutes(user.getKey())) {
-        //     log.error("compareFaceSync outOfLimitMinutes...");
-        //     throw new StatusException("500503", "人脸验证太频繁,请10分钟后重试!");
-        // }
+        if (this.isFaceApiLimitSeconds(user.getKey())) {
+            log.error("compareFaceSync outOfLimitSeconds...");
+            throw new StatusException("500503", "人脸验证太频繁,请稍后重试!");
+        }
+        if (this.isFaceApiLimitMinutes(user.getKey())) {
+            log.error("compareFaceSync outOfLimitMinutes...");
+            throw new StatusException("500503", "人脸验证太频繁,请10分钟后重试!");
+        }
 
         CompareFaceSyncInfo compareFaceSyncInfo = examCaptureService.compareFaceSync(studentCache, fileUrl);
         // CompareFaceSyncInfo compareFaceSyncInfo = examCaptureService.compareFaceSyncByFileUrl(user.getUserId(), baseFaceToken, fileUrl);