feat: 添加唯一计数去重功能,优化福袋相关统计逻辑
This commit is contained in:
1 parent
90b7daa84e
commit
d81eea63c9
10 files changed
+333
-54
No files matched your search
@@ -2010,7 +2010,7 @@ class underlying_operations:
|
||||
|
||||
return ""
|
||||
|
||||
def extract_ocr_content(self, content=[], return_confidence=False):
|
||||
def extract_ocr_content(self, content=None, return_confidence=False):
|
||||
"""对OCR识别到的内容进行取值和拼接,变成完整的一段内容
|
||||
|
||||
参数:
|
||||
@@ -2021,7 +2021,7 @@ class underlying_operations:
|
||||
如果return_confidence=False: 返回文本字符串
|
||||
如果return_confidence=True: 返回(text, confidence_info)元组,其中confidence_info是置信度信息字典
|
||||
"""
|
||||
ocr_result = content
|
||||
ocr_result = content or []
|
||||
|
||||
# 用于收集置信度信息
|
||||
confidence_scores = []
|
||||
@@ -2431,6 +2431,7 @@ class underlying_operations:
|
||||
stderr=subprocess.PIPE,
|
||||
timeout=5.0,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
|
||||
# 检查是否有权限错误
|
||||
@@ -2479,6 +2480,7 @@ class underlying_operations:
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
|
||||
if "event" not in result.stdout.lower():
|
||||
@@ -2493,8 +2495,7 @@ class underlying_operations:
|
||||
|
||||
注意:uiautomator 在某些设备上可能也需要权限,但可以尝试作为备选方案。
|
||||
"""
|
||||
import subprocess
|
||||
|
||||
|
||||
# 使用 uiautomator swipe 命令
|
||||
# 注意:uiautomator 命令格式可能因 Android 版本而异
|
||||
# Android 5.0+: uiautomator swipe <x1> <y1> <x2> <y2> [steps]
|
||||
@@ -2507,6 +2508,7 @@ class underlying_operations:
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
timeout=5.0,
|
||||
check=False,
|
||||
)
|
||||
|
||||
if result.returncode != 0:
|
||||
@@ -2521,8 +2523,7 @@ class underlying_operations:
|
||||
优点:绕过部分权限检查
|
||||
缺点:需要 root 权限,实现复杂,不同设备的事件格式可能不同
|
||||
"""
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
|
||||
# 获取触摸设备路径(通常是 /dev/input/eventX)
|
||||
result = subprocess.run(
|
||||
@@ -2532,6 +2533,7 @@ class underlying_operations:
|
||||
stderr=subprocess.DEVNULL,
|
||||
text=True,
|
||||
timeout=3.0,
|
||||
check=False,
|
||||
)
|
||||
|
||||
# 解析设备路径(简化版,实际需要更复杂的解析)
|
||||
@@ -2579,6 +2581,7 @@ class underlying_operations:
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
timeout=timeout_seconds,
|
||||
check=False,
|
||||
)
|
||||
return r.returncode == 0
|
||||
except Exception:
|
||||
@@ -2598,6 +2601,7 @@ class underlying_operations:
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
errors="ignore",
|
||||
check=False,
|
||||
)
|
||||
return (r.returncode == 0), (r.stdout or "")
|
||||
except Exception:
|
||||
@@ -2949,6 +2953,7 @@ class underlying_operations:
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
timeout=2,
|
||||
check=False,
|
||||
)
|
||||
subprocess.run(
|
||||
f'{self._adb()} -s {device_id} pull {remote} "{local_path}"',
|
||||
@@ -2956,6 +2961,7 @@ class underlying_operations:
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
timeout=2,
|
||||
check=False,
|
||||
)
|
||||
return os.path.exists(local_path)
|
||||
except subprocess.TimeoutExpired:
|
||||
|
||||
Reference in new issue
Block a user