PUGE 1 месяц назад
Родитель
Сommit
6afc62f559
4 измененных файлов с 66 добавлено и 53 удалено
  1. 4 0
      三一平台.py
  2. 50 34
      控制vm虚拟机.py
  3. 11 18
      爱回收.py
  4. 1 1
      飞书提交数据.py

+ 4 - 0
三一平台.py

@@ -1154,6 +1154,10 @@ class MainWindow(QMainWindow):
         """检测区域车辆"""
         if not self.is_monitoring:
             return
+        # 如果正在执行扫码任务,跳过区域检测
+        if self.is_processing_scan:
+            self.add_log("⏳ 正在执行扫码任务,跳过本次区域检测")
+            return
         
         load_region_id = self.load_region_combo.currentData() if self.load_region_combo.currentIndex() > 0 else None
         unload_region_id = self.unload_region_combo.currentData() if self.unload_region_combo.currentIndex() > 0 else None

+ 50 - 34
控制vm虚拟机.py

@@ -595,38 +595,45 @@ class VmControlGUI:
     def script_b_worker(self):
         """脚本B工作线程 - 大键盘单键循环"""
         try:
-            # 按键间隔
+            # 按键间隔(30-50秒)
             interval_min = int(self.b_key_interval_min.get())
             interval_max = int(self.b_key_interval_max.get())
             
-            # 停止延迟
+            # 停止延迟(10-30秒)
             stop_delay_min = int(self.b_stop_delay_min.get())
             stop_delay_max = int(self.b_stop_delay_max.get())
             
-            # 停止后延迟(毫秒)
+            # 停止序列中的延迟(200-500毫秒)
             wait_min = int(self.b_wait_after_stop_min.get()) / 1000.0
             wait_max = int(self.b_wait_after_stop_max.get()) / 1000.0
             
             self.log("=" * 50)
             self.log("🚀 脚本B - 大键盘单键循环开始")
-            self.log(f"按键: 小键盘2")
-            self.log(f"按键间隔: {interval_min}-{interval_max}秒")
+            self.log(f"按键1: - (减号) 每300-800ms一次")
+            self.log(f"按键2: 2 (数字2) 每{interval_min}-{interval_max}秒一次")
             self.log("=" * 50)
             
+            # 记录上次按2的时间
+            last_key2_time = time.time()
+            
+            # ===== 正常运行 =====
             while not self.b_stop_flag:
-                # 按小键盘2
-                self.log("发送: 小键盘2")
-                self.press_key(0x62, True)
+                # 按 - (减号键) - 每300-800ms一次
+                self.log("发送: - (减号)")
+                self.press_key(0xBD, False)
                 
-                # 等待间隔
-                interval = random.uniform(interval_min, interval_max)
-                sleep_chunks = max(1, int(interval / 0.5))
-                for _ in range(sleep_chunks):
-                    if self.b_stop_flag:
-                        break
-                    time.sleep(0.5)
+                # 减号间隔 300-800ms
+                key_delay = random.uniform(0.3, 0.8)
+                time.sleep(key_delay)
+                
+                # 检查是否该按 2(30-50秒一次)
+                current_time = time.time()
+                if current_time - last_key2_time >= random.uniform(interval_min, interval_max):
+                    self.log("发送: 2 (数字2)")
+                    self.press_key(0x32, False)
+                    last_key2_time = current_time
             
-            # ===== 执行停止序列 =====
+            # ===== 执行停止序列(共3次) =====
             self.log("脚本B停止序列开始")
             
             # 随机延迟
@@ -636,17 +643,15 @@ class VmControlGUI:
             
             # 执行3次停止序列
             for i in range(3):
-                if self.b_stop_flag:
-                    break
                 self.log(f"停止序列 {i+1}/3")
                 
-                # 按 = 
+                # 按 =
                 wait_time = random.uniform(wait_min, wait_max)
                 self.log(f"  按 = (延迟 {wait_time*1000:.0f}ms)")
                 self.press_key(0xBB, False)
                 time.sleep(wait_time)
                 
-                # 按小键盘2
+                # 按 小键盘2
                 wait_time = random.uniform(wait_min, wait_max)
                 self.log(f"  按 小键盘2 (延迟 {wait_time*1000:.0f}ms)")
                 self.press_key(0x62, True)
@@ -655,7 +660,12 @@ class VmControlGUI:
                 # 按 ESC
                 self.log(f"  按 ESC")
                 self.press_key(0x1B, False)
-                time.sleep(0.2)
+                
+                # 每次之间等待200-800ms(最后一次不等待)
+                if i < 2:
+                    between_delay = random.uniform(0.2, 0.8)
+                    self.log(f"  等待 {between_delay*1000:.0f}ms 后执行下一次")
+                    time.sleep(between_delay)
             
             self.log("✅ 脚本B停止序列完成")
             self.b_status_label.config(text="脚本B状态: 已停止", foreground="gray")
@@ -803,6 +813,8 @@ class VmControlGUI:
                 0x27: b"right",
                 0x1B: b"esc",
                 0xBB: b"=",
+                0xBD: b"-",
+                0x32: b"2",
             }
             
             if self.ghost_available:
@@ -918,25 +930,27 @@ class VmControlGUI:
         self.log(f"按键: 小键盘8 -> 小键盘2 -> 左键 -> 空格")
         self.log("=" * 50)
 
+        # ===== 只在开始前执行一次鼠标点击激活窗口 =====
+        if not self.stop_flag:
+            try:
+                if win32gui.IsWindow(self.vm_hwnd):
+                    self.activate_window()
+                    abs_x, abs_y = self.get_absolute_coords(self.ACTIVATE_X, self.ACTIVATE_Y)
+                    if abs_x is not None:
+                        self.log(f"初始点击激活虚拟机 ({abs_x}, {abs_y})")
+                        self.click_at(abs_x, abs_y)
+                        time.sleep(0.3)
+            except Exception as e:
+                self.log(f"初始点击失败: {e}")
+
+        # ===== 进入键盘循环 =====
         while not self.stop_flag:
             try:
                 if not win32gui.IsWindow(self.vm_hwnd):
                     self.log("窗口已关闭,停止循环")
                     break
 
-                if not self.activate_window():
-                    self.log("无法激活窗口,等待 3 秒...")
-                    time.sleep(3)
-                    continue
-
-                abs_x, abs_y = self.get_absolute_coords(self.ACTIVATE_X, self.ACTIVATE_Y)
-                if abs_x is None:
-                    time.sleep(2)
-                    continue
-                
-                self.click_at(abs_x, abs_y)
-                time.sleep(0.3)
-
+                # 执行一轮按键(不再点击鼠标)
                 for key_code, extended, key_name in keys:
                     if self.stop_flag:
                         break
@@ -953,6 +967,7 @@ class VmControlGUI:
                 if round_count % 10 == 0:
                     self.log(f"📊 已执行 {round_count} 轮")
 
+                # 暂停检查
                 current_time = time.time()
                 if current_time - last_pause_time >= random.uniform(pause_min, pause_max):
                     self.log(f"⏸ 暂停 {pause_dur} 秒")
@@ -968,6 +983,7 @@ class VmControlGUI:
                     last_pause_time = time.time()
                     continue
 
+                # 轮次间隔
                 round_interval = random.uniform(round_min, round_max)
                 sleep_chunks = max(1, int(round_interval / 0.5))
                 for _ in range(sleep_chunks):

+ 11 - 18
爱回收.py

@@ -243,7 +243,7 @@ class PhoneQueryApp:
             cb.grid(row=row, column=col, sticky=tk.W, padx=10, pady=3)
         
         # ==================== 自动检测区域 ====================
-        auto_detect_frame = ttk.LabelFrame(main_frame, text="自动检测与收藏", padding="10")
+        auto_detect_frame = ttk.LabelFrame(main_frame, text="自动筛选", padding="10")
         auto_detect_frame.grid(row=4, column=0, sticky=(tk.W, tk.E), pady=(0, 10))
         auto_detect_frame.columnconfigure(2, weight=1)
         
@@ -255,7 +255,7 @@ class PhoneQueryApp:
         ttk.Label(auto_detect_frame, text="次", font=("Arial", 10)).grid(row=0, column=2, sticky=tk.W, padx=(0, 20))
         
         # 启动按钮
-        self.start_auto_btn = ttk.Button(auto_detect_frame, text="🚀 启动自动检测", command=self.start_auto_detect, width=18)
+        self.start_auto_btn = ttk.Button(auto_detect_frame, text="🚀 启动自动筛选", command=self.start_auto_detect, width=18)
         self.start_auto_btn.grid(row=0, column=3, padx=(0, 10))
         
         # 停止按钮
@@ -806,10 +806,10 @@ class PhoneQueryApp:
             
         # 确认启动
         result = messagebox.askyesno("确认启动", 
-                                   f"将自动检测所有符合条件的商品\n"
-                                   f"机型: {keyword}\n"
-                                   f"循环次数阈值: {threshold} 次\n\n"
-                                   f"检测到的商品将自动收藏,是否继续?")
+                           f"将自动筛选所有符合条件的商品\n"
+                           f"机型: {keyword}\n"
+                           f"循环次数阈值: {threshold} 次\n\n"
+                           f"符合条件的商品将高亮显示,是否继续?")
         if not result:
             return
             
@@ -933,18 +933,11 @@ class PhoneQueryApp:
                     
                     # 判断是否满足条件
                     if cycle_num > 0 and cycle_num <= threshold:
-                        # 满足条件,收藏
-                        item_no = product_no or sale_goods_no
-                        success, msg = self.add_to_collection(item_no)
-                        
-                        if success:
-                            total_collected += 1
-                            page_collected += 1
-                            # 在列表中显示
-                            self.root.after(0, lambda p=product, c=cycle_count: self.display_auto_collected(p, c))
-                        else:
-                            # 收藏失败,记录日志
-                            print(f"自动收藏失败: {name} - {msg}")
+                        # 满足条件,在列表中显示(不收藏)
+                        total_collected += 1
+                        page_collected += 1
+                        # 在列表中显示(绿色高亮表示符合条件)
+                        self.root.after(0, lambda p=product, c=cycle_count: self.display_auto_collected(p, c))
                             
                     # 更新统计
                     self.root.after(0, lambda tc=total_checked, tl=total_collected: 

+ 1 - 1
飞书提交数据.py

@@ -618,7 +618,7 @@ class FeishuSubmitApp:
                         }]
                     }
                 } if market_person else {"type": 11},
-                "flde7thxT7": {"type": 3, "value": "optKdksJ5a"},
+                "flde7thxT7": {"type": 3, "value": "optEkk65hv"},
                 "fldaxavu52": {"type": 3, "value": "optHsn4zKU"},
                 "fldMpwPaI1": {"type": 17}  # 图片字段,默认空
             }