浏览代码

抓拍照片md5一样时,日志记录

Michael Wang 4 年之前
父节点
当前提交
a03efd7c79
共有 1 个文件被更改,包括 19 次插入1 次删除
  1. 19 1
      src/components/FaceRecognition/FaceRecognition.vue

+ 19 - 1
src/components/FaceRecognition/FaceRecognition.vue

@@ -444,6 +444,11 @@ export default {
         this.msg = "人脸比对中...";
         this.msg = "人脸比对中...";
         console.log(this.msg);
         console.log(this.msg);
         await this.faceCompareSync(captureFilePath, signIdentifier);
         await this.faceCompareSync(captureFilePath, signIdentifier);
+        this.logger({
+          action: "同步比对照片详细日志",
+          fileUrl: captureFilePath,
+          signIdentifier,
+        });
         console.log("人脸比对成功");
         console.log("人脸比对成功");
       } catch (error) {
       } catch (error) {
         console.log("同步照片比对流程失败");
         console.log("同步照片比对流程失败");
@@ -517,6 +522,13 @@ export default {
         const fileMd5Base64 = window.btoa(
         const fileMd5Base64 = window.btoa(
           String.fromCharCode(...MD5.digest(buffer))
           String.fromCharCode(...MD5.digest(buffer))
         );
         );
+        if (fileMd5Base64 === this.__previousFileMD5Base64) {
+          this.logger({
+            page: "摄像头框",
+            detail: "抓拍照片异常",
+            error: "两次fileMd5Base64一样,疑似摄像头卡住",
+          });
+        }
         // console.log(fileMd5);
         // console.log(fileMd5);
         // console.log(fileMd5, fileMd5Base64);
         // console.log(fileMd5, fileMd5Base64);
 
 
@@ -570,6 +582,7 @@ export default {
             ]);
             ]);
             throw new Error("图片校验失败");
             throw new Error("图片校验失败");
           }
           }
+          this.__previousFileMD5Base64 = fileMd5Base64;
         } catch (error) {
         } catch (error) {
           this.logger({
           this.logger({
             page: "摄像头框",
             page: "摄像头框",
@@ -592,7 +605,12 @@ export default {
         // console.log(response);
         // console.log(response);
         resultUrl = res.data.accessUrl;
         resultUrl = res.data.accessUrl;
         signIdentifier = res.data.signIdentifier;
         signIdentifier = res.data.signIdentifier;
-        this.logger({ page: "摄像头框", detail: "抓拍照片保存成功" });
+        this.logger({
+          page: "摄像头框",
+          detail: "抓拍照片保存成功",
+          resultUrl,
+          fileMd5Base64,
+        });
         window._hmt.push(["_trackEvent", "摄像头框", "抓拍照片保存成功"]);
         window._hmt.push(["_trackEvent", "摄像头框", "抓拍照片保存成功"]);
       } catch (e) {
       } catch (e) {
         console.log(e);
         console.log(e);