From 74ac7b4a4e87fa64973f970fddebb4be00c16bba Mon Sep 17 00:00:00 2001
From: Faker <Faker@apple.com>
Date: Mon, 21 Nov 2022 16:55:57 +0800
Subject: [PATCH] update

---
 JDJRValidator_Pure.js | 4 ++++
 jd_joy_feedPets.js    | 1 +
 2 files changed, 5 insertions(+)

diff --git a/JDJRValidator_Pure.js b/JDJRValidator_Pure.js
index 55daaff..dd5957c 100644
--- a/JDJRValidator_Pure.js
+++ b/JDJRValidator_Pure.js
@@ -221,10 +221,12 @@ class JDJRValidator {
     this.data = {};
     this.x = 0;
     this.t = Date.now();
+    this.trynum = 0;
   }
 
   async run(scene) {
     try {
+      if (this.trynum > 5) return '';
       const tryRecognize = async () => {
         const x = await this.recognize(scene);
 
@@ -250,6 +252,7 @@ class JDJRValidator {
         return result;
       } else {
         console.count("验证失败");
+        this.trynum++
         // console.count(JSON.stringify(result));
         await sleep(300);
         return await this.run(scene);
@@ -542,6 +545,7 @@ function injectToRequest2(fn, scene = 'cww') {
 async function injectToRequest(scene = 'cww') {
   console.log('JDJR验证中......');
   const res = await new JDJRValidator().run(scene);
+  if (res == '') return;
   return res.validate;
 }
 
diff --git a/jd_joy_feedPets.js b/jd_joy_feedPets.js
index d11a06a..45aad34 100644
--- a/jd_joy_feedPets.js
+++ b/jd_joy_feedPets.js
@@ -59,6 +59,7 @@ let FEED_NUM = 20;   //喂食数量默认20g,可选 10,20,40,80 , 其他数字
             }
             $.validate = '';
             $.validate = await Slider.injectToRequest()
+            if (!$.validate) {console.log('滑块验证失败过多,跳出');continue};
             await feedPets(FEED_NUM);//喂食
             //await ThreeMeals();//三餐
             await showMsg();