新增日志,修改个别国家打招呼发中文问题
This commit is contained in:
@@ -226,7 +226,6 @@ class ScriptManager():
|
||||
self.comment_flow(filePath, session, udid, recomend_cx, recomend_cy)
|
||||
event.wait(timeout=2)
|
||||
|
||||
|
||||
home = AiUtils.findHomeButton(session)
|
||||
if not home:
|
||||
raise Exception("没有找到首页按钮,重置")
|
||||
@@ -490,7 +489,8 @@ class ScriptManager():
|
||||
state = result.get("state", 0)
|
||||
|
||||
if not state:
|
||||
LogManager.method_info(f"当前主播的状态是:{state} 不通行,取出数据移到列表尾部 继续下一个", "关注打招呼",
|
||||
LogManager.method_info(f"当前主播的状态是:{state} 不通行,取出数据移到列表尾部 继续下一个",
|
||||
"关注打招呼",
|
||||
udid)
|
||||
AiUtils.pop_aclist_first(mode="move")
|
||||
continue
|
||||
@@ -540,7 +540,6 @@ class ScriptManager():
|
||||
LogManager.method_info(f"输入主播id:{aid or '暂无数据'}", "关注打招呼", udid)
|
||||
input.set_text(f"{aid or '暂无数据'}\n")
|
||||
|
||||
|
||||
# 定位 "关注" 按钮 通过关注按钮的位置点击主播首页
|
||||
|
||||
session.appium_settings({"snapshotMaxDepth": 25})
|
||||
@@ -571,12 +570,17 @@ class ScriptManager():
|
||||
|
||||
cellClickResult, workCount = ControlUtils.clickFirstVideoFromDetailPage(session)
|
||||
|
||||
LogManager.method_info(f"是否有视频:{cellClickResult} 作品的数量为:{workCount}", "关注打招呼", udid)
|
||||
|
||||
LogManager.method_info(f"点击第一个视频", "关注打招呼", udid)
|
||||
|
||||
event.wait(timeout=2)
|
||||
|
||||
# 观看主播视频
|
||||
def viewAnchorVideo(workCount):
|
||||
print("开始查看视频,并且重新调整查询深度")
|
||||
LogManager.method_info("开始查看视频,调整节点深度为5", "关注打招呼", udid)
|
||||
|
||||
session.appium_settings({"snapshotMaxDepth": 5})
|
||||
|
||||
if workCount > 3:
|
||||
@@ -611,7 +615,8 @@ class ScriptManager():
|
||||
LogManager.method_info("保存屏幕图像成功", "关注打招呼", udid)
|
||||
event.wait(timeout=2)
|
||||
# 查找add图标
|
||||
r = ControlUtils.clickLike(session, udid)
|
||||
LogManager.method_info("开始点击点赞", "关注打招呼", udid)
|
||||
ControlUtils.clickLike(session, udid)
|
||||
|
||||
count -= 1
|
||||
LogManager.method_info("准备停止脚本", method="task")
|
||||
@@ -623,8 +628,7 @@ class ScriptManager():
|
||||
event.wait(timeout=1)
|
||||
LogManager.method_info("停止脚本成功", method="task")
|
||||
|
||||
|
||||
|
||||
LogManager.method_info(f"是否进行评论:{isComment}", "关注打招呼", udid)
|
||||
# 使用OCR进行评论
|
||||
if isComment:
|
||||
self.comment_flow(filePath, session, udid, 100, 100)
|
||||
@@ -632,6 +636,8 @@ class ScriptManager():
|
||||
|
||||
session.appium_settings({"snapshotMaxDepth": 12})
|
||||
|
||||
LogManager.method_info(f"检查当前是否为视频页面", "关注打招呼", udid)
|
||||
|
||||
is_back_enabled = ControlUtils.isClickBackEnabled(session)
|
||||
if not is_back_enabled:
|
||||
print("返回失败")
|
||||
@@ -675,8 +681,6 @@ class ScriptManager():
|
||||
msgButton = AiUtils.getSendMesageButton(session)
|
||||
event.wait(timeout=2)
|
||||
|
||||
|
||||
|
||||
if msgButton.exists:
|
||||
# 进入聊天页面
|
||||
msgButton.click()
|
||||
@@ -1629,7 +1633,6 @@ class ScriptManager():
|
||||
user_text = None
|
||||
info_count += 1
|
||||
|
||||
|
||||
if user_text:
|
||||
print("点击进入用户主页")
|
||||
user_text.tap()
|
||||
@@ -1900,7 +1903,6 @@ class ScriptManager():
|
||||
LogManager.method_error(f"检测不到收件箱", "检测消息", udid)
|
||||
raise Exception("当前页面找不到收件箱,重启")
|
||||
|
||||
|
||||
# 放在 ScriptManager 类外面或 utils 里
|
||||
def interruptible_sleep(self, event: threading.Event, seconds: float, slice_: float = 1.0):
|
||||
"""把一次长 sleep 拆成 1 秒一片,随时响应 event"""
|
||||
@@ -1942,6 +1944,8 @@ class ScriptManager():
|
||||
LogManager.method_info("开始进行切换账号", "切换账号", udid)
|
||||
LogManager.method_info("重启进行切换账号", "切换账号", udid)
|
||||
|
||||
#
|
||||
|
||||
# 打开个人主页
|
||||
session.appium_settings({"snapshotMaxDepth": 15})
|
||||
user_home = session.xpath('//XCUIElementTypeButton[@name="a11y_vo_profile" or @label="主页"]')
|
||||
@@ -2060,6 +2064,7 @@ class ScriptManager():
|
||||
"切换账号",
|
||||
udid
|
||||
)
|
||||
print(f"本次切换到账号: {target_account} (use={next_idx}, next={(next_idx + 1) % n})", "切换账号", udid)
|
||||
|
||||
# 在同一份 OCR 结果里定位该用户名的坐标并点击
|
||||
result = TencentOCR.find_last_name_bbox(ocr_json, target_account)
|
||||
@@ -2072,7 +2077,7 @@ class ScriptManager():
|
||||
center_y = result["center"]["y"]
|
||||
|
||||
# 随机偏移(增强拟人)
|
||||
num = random.randint(-60, 60)
|
||||
num = random.randint(-10, 10)
|
||||
# 分辨率/坐标映射(按你设备比例;你原来是 /3)
|
||||
tap_x = int((center_x + num) / 3)
|
||||
tap_y = int((center_y + num) / 3)
|
||||
|
||||
Reference in New Issue
Block a user