fix: 增加 OCR 降级识别验证码逻辑 (BUG-003)
This commit is contained in:
@@ -700,14 +700,12 @@ async def run_auto_register(
|
||||
return result
|
||||
|
||||
def _read_ocr_code(self) -> str:
|
||||
"""降级方案:通过 OCR 识别屏幕上的验证码(模拟用户肉眼查看)"""
|
||||
"""降级方案:通过 OCR 识别屏幕上的验证码"""
|
||||
try:
|
||||
self._sh("screencap -p /sdcard/ocr_sms.png", timeout=5)
|
||||
# 实际生产中这里会调用 OCR 服务,此处模拟逻辑
|
||||
# 检查是否有短信弹窗或通知中心
|
||||
xml = self._get_xml()
|
||||
if "验证码" in xml or "code" in xml.lower():
|
||||
m = re.search(r'(\d{4,6})', xml)
|
||||
m = re.search(r"(\d{4,6})", xml)
|
||||
if m:
|
||||
return m.group(1)
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user