'commit'
This commit is contained in:
@@ -61,8 +61,25 @@ async def check_and_close_ad(d):
|
||||
ad_result = await ReadImageKit.detect_ad_popup(screenshot_path, device_info=device_info)
|
||||
if ad_result:
|
||||
x, y = ad_result["x"], ad_result["y"]
|
||||
logger.info(f"通过视觉大模型检测到广告关闭按钮: ({x}, {y})")
|
||||
d.click(x, y)
|
||||
ad_type = ad_result.get("ad_type")
|
||||
|
||||
logger.info(f"通过视觉大模型检测到广告关闭按钮: ({x}, {y}) [Type: {ad_type}]")
|
||||
|
||||
# 针对“新电兔AI”兔子广告的强力关闭策略
|
||||
if ad_type == "rabbit":
|
||||
logger.info(">>> 检测到顽固的兔子广告,执行强力双击策略...")
|
||||
# 使用 u2 的 double_click,它比两次 click + sleep 更快
|
||||
d.double_click(x, y, duration=0.05)
|
||||
|
||||
# 处理“误触背景卡片”的逻辑
|
||||
logger.info(">>> 考虑到可能误触背景卡片,等待 2s 后执行返回操作...")
|
||||
await asyncio.sleep(2.0)
|
||||
d.press("back")
|
||||
await asyncio.sleep(1.0)
|
||||
logger.info(">>> 已尝试从误触页面返回。")
|
||||
else:
|
||||
d.click(x, y)
|
||||
|
||||
if os.path.exists(screenshot_path):
|
||||
os.remove(screenshot_path)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user