修复bug,临时提交

This commit is contained in:
zw
2025-08-07 21:37:46 +08:00
parent 3f7c366278
commit d7c98d1fc8
4 changed files with 7 additions and 7 deletions

View File

@@ -41,7 +41,6 @@ class AiUtils(object):
# 检查是否有匹配结果
if loc[0].size > 0:
print("匹配到目标了")
# 取第一个匹配位置
pt = zip(*loc[::-1]).__next__() # 获取第一个匹配点的坐标
center_x = int(pt[0] + w // 2)
@@ -49,11 +48,11 @@ class AiUtils(object):
# print(f"第一个匹配到的小心心中心坐标: ({center_x}, {center_y})")
return center_x, center_y
else:
print("未找到匹配的目标")
return -1, -1
except Exception as e:
LogManager.error(f"加载素材失败:{e}", udid)
print(e)
return -1, -1
# 使用正则查找字符串中的数字
@classmethod
@@ -215,7 +214,7 @@ class AiUtils(object):
def findCloseButton(cls,udid="eca000fcb6f55d7ed9b4c524055214c26a7de7aa"):
client = wda.USBClient(udid)
session = client.session()
session.appium_settings({"snapshotMaxDepth": 30})
session.appium_settings({"snapshotMaxDepth": 0})
r = session.xpath("//XCUIElementTypeButton[@name='关闭屏幕']")
try:
if r.label == "关闭屏幕":

View File

@@ -17,11 +17,12 @@ class ThreadManager():
@classmethod
def stop(cls, udid):
print(cls.threads)
info = cls.threads[udid]
if info:
info["stopEvent"].set() # 停止线程
info["thread"].join(timeout=3) # 等待线程退出
del cls.threads[udid]
LogManager.info("停止线程成功")
LogManager.info("停止线程成功", udid)
else:
LogManager.info("无此线程,无需关闭")
LogManager.info("无此线程,无需关闭", udid)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -69,7 +69,7 @@ class ScriptManager():
# 查找首页按钮
homeButton = AiUtils.findHomeButton(udid)
if homeButton:
print("查看视频")
print("有首页按钮,查看视频")
videoTime = random.randint(5, 15)
time.sleep(videoTime)
@@ -84,7 +84,7 @@ class ScriptManager():
print("准备划到下一个视频")
client.swipe_up()
else:
print("目前没有首页按钮。需要另外处理")
print("找不到首页按钮。出错了")
else:
nextTime = random.randint(1, 5)
time.sleep(nextTime)