jerry 3 mesiacov pred
rodič
commit
17ac506a88
2 zmenil súbory, kde vykonal 61 pridanie a 15 odobranie
  1. 20 0
      plugins/tls_plugin2.py
  2. 41 15
      plugins/vfs_plugin2.py

+ 20 - 0
plugins/tls_plugin2.py

@@ -211,6 +211,26 @@ class TlsPlugin2(IVSPlg):
             cf = CloudflareBypasser(self.page, log=self.config.debug)
             if not cf.bypass(max_retry=15):
                 raise BizLogicError("Cloudflare bypass timeout")
+            
+            wait_start = time.time()
+            while True:
+                # 获取页面 HTML,转小写
+                # 注意:如果此处报错 "页面被刷新",是 DrissionPage 的机制问题,
+                # 但你要求先不处理复杂错误,所以这里保持最简单的写法。
+                html = self.page.html.lower()
+                
+                # 检查是否在排队室 (法语或英语)
+                if "file d'attente" in html or "waiting room" in html:
+                    # 如果等太久(比如1小时),就强制停止
+                    if time.time() - wait_start > 6 * 60:
+                        self._log("Waiting room timeout (1h).")
+                        break
+                        
+                    self._log("In Waiting Room... Waiting for auto-refresh.")
+                    time.sleep(30) # 截图说页面会自动刷新,所以这里只sleep,不动浏览器
+                else:
+                    # 页面里没有“等候室”的字了,说明出来了
+                    break
 
             # --- 登录页面检查 ---
             if not self.page.ele('#email-input-field'):

+ 41 - 15
plugins/vfs_plugin2.py

@@ -909,10 +909,6 @@ class VfsPlugin2(IVSPlg):
         
         raise BizLogicError("Failed to refresh Cloudflare Turnstile token (Timeout)")
 
-    # -------------------------------------------------------------
-    # 核心预约逻辑 (DrissionPage 版)
-    # -------------------------------------------------------------
-
     def book(self, slot_info: VSQueryResult, user_inputs) -> VSBookResult:
         """
         执行完整的预约流程
@@ -1179,6 +1175,11 @@ class VfsPlugin2(IVSPlg):
             "employerFirstName": "",
             "employerLastName": "",
             "salutation": "",
+            "Subclasscode": None,
+            "VisaToken": None,
+            "centerClassCode": None,
+            "dateOfApplication": None,
+            "selectedSubvisaCategory": None,
             "gender": gender_code,
             "contactNumber": str(user_inputs.get("phone", "")),
             "dialCode": dial_code,
@@ -1192,17 +1193,42 @@ class VfsPlugin2(IVSPlg):
             "dateOfBirth": dob,
             "nationalId": None,
             "nationalityCode": get_country_iso3(str(user_inputs.get("nationality", ""))),
-            "state": None, "city": None, "addressline1": None, "addressline2": None, "pincode": None,
-            "isEndorsedChild": False, "applicantType": 0, "vlnNumber": None, "applicantGroupId": 0,
-            "parentPassportNumber": "", "parentPassportExpiry": "", "dateOfDeparture": None,
-            "entryType": "", "eoiVisaType": "", "passportType": "", "vfsReferenceNumber": "",
-            "familyReunificationCerificateNumber": "", "PVRequestRefNumber": "", "PVStatus": "",
-            "PVStatusDescription": "", "PVCanAllowRetry": True, "PVisVerified": False,
-            "eefRegistrationNumber": "", "isAutoRefresh": True, "helloVerifyNumber": "",
-            "OfflineCClink": "", "idenfystatuscheck": False, "vafStatus": None,
-            "SpecialAssistance": "", "AdditionalRefNo": None, "juridictionCode": "",
-            "canInitiateVAF": False, "canEditVAF": False, "canDeleteVAF": False,
-            "canDownloadVAF": False, "Retryleft": "",
+            "state": user_inputs.get("state"),
+            "city": user_inputs.get("city"),
+            "addressline1": user_inputs.get("addressline1"),
+            "addressline2": user_inputs.get("addressline2"),
+            "pincode": None,
+            "isEndorsedChild": False,
+            "applicantType": 0,
+            "vlnNumber": None,
+            "applicantGroupId": 0,
+            "parentPassportNumber": "",
+            "parentPassportExpiry": "",
+            "dateOfDeparture": None,
+            "entryType": "",
+            "eoiVisaType": "",
+            "passportType": "",
+            "vfsReferenceNumber": "",
+            "familyReunificationCerificateNumber": "",
+            "PVRequestRefNumber": "",
+            "PVStatus": "",
+            "PVStatusDescription": "",
+            "PVCanAllowRetry": True,
+            "PVisVerified": False,
+            "eefRegistrationNumber": "",
+            "isAutoRefresh": True,
+            "helloVerifyNumber": "",
+            "OfflineCClink": "",
+            "idenfystatuscheck": False,
+            "vafStatus": None,
+            "SpecialAssistance": "",
+            "AdditionalRefNo": None,
+            "juridictionCode": "",
+            "canInitiateVAF": False,
+            "canEditVAF": False,
+            "canDeleteVAF": False,
+            "canDownloadVAF": False,
+            "Retryleft": "",
             # 这里的 IP 应该已经在 create_session 时获取到了
             "ipAddress": self.real_ip
         }