root hai 1 mes
pai
achega
32c879217d
Modificáronse 2 ficheiros con 10 adicións e 11 borrados
  1. 8 8
      booker_builtin.py
  2. 2 3
      plugins/vfs_plugin.py

+ 8 - 8
booker_builtin.py

@@ -127,16 +127,16 @@ class BuiltinBookerGCO:
 
     def _execute_book_job(self, task: Task, query_result: VSQueryResult):
         queue_name = f"auto.{query_result.apt_type.routing_key}"
-        task_data = VSCloudApi.Instance().get_vas_task_pop(queue_name)
-        if not task_data:
-            return 
-        
-        task_id = task_data['id']
-        order_id = task_data.get('order_id')
-        user_input = task_data.get('user_inputs', {})
+
+        task_id = None
         booking_success = False
-        
         try:
+            task_data = VSCloudApi.Instance().get_vas_task_pop(queue_name)
+            if not task_data:
+                return 
+            task_id = task_data['id']
+            order_id = task_data.get('order_id')
+            user_input = task_data.get('user_inputs', {})
             book_res = task.instance.book(query_result, user_input)
             if book_res.success:
                 booking_success = True

+ 2 - 3
plugins/vfs_plugin.py

@@ -794,11 +794,10 @@ class VfsPlugin(IVSPlg):
         resp = self._perform_request("GET", url, headers=headers)
         return resp.json()            
 
-    def _read_otp_email(self) -> str:
+    def _read_otp_email(self, sender='donotreply at vfshelpline.com') -> str:
         # 保持原样,这部分使用云API读取邮件,不依赖本地网络库
         master_email = "visafly666@gmail.com"
         recipient = self.config.account.username
-        sender = "donotreply at vfshelpline.com"
         subject_keywords = "One Time Password"
         body_keywords = "OTP"
         now_utc = datetime.utcnow()
@@ -989,7 +988,7 @@ class VfsPlugin(IVSPlg):
                 raise BizLogicError(message='Applicant OTP send failed')
             
             # 复用之前的读邮件逻辑
-            otp_code = self._read_otp_email()
+            otp_code = self._read_otp_email(sender='donotreply at vfsglobal.com')
             if not self._applicant_otp_verify(apt_config, final_urn, otp_code):
                 raise BizLogicError(message='Applicant OTP verify failed')