2025-10-24 更新评论功能
This commit is contained in:
@@ -45,6 +45,7 @@ class ScriptManager():
|
||||
self.resources_dir = project_root / "resources"
|
||||
self.comment_dir = self.resources_dir / "comment.png"
|
||||
self.comment_add_dir = self.resources_dir / "insert_comment.png"
|
||||
self.comment_add_dir2 = self.resources_dir / "insert_comment2.png"
|
||||
|
||||
self.initialized = True # 标记已初始化
|
||||
|
||||
@@ -73,25 +74,44 @@ class ScriptManager():
|
||||
img.save(filePath)
|
||||
|
||||
# 从评论列表中随机取出一条数据,进行评论
|
||||
single_comment = random.choice(Variables.commentList)
|
||||
if Variables.commentList:
|
||||
single_comment = random.choice(Variables.commentList)
|
||||
else:
|
||||
single_comment = "评论没有导入数据"
|
||||
|
||||
|
||||
coord2 = OCRUtils.find_template(str(self.comment_add_dir), filePath)
|
||||
# print(single_comment)
|
||||
|
||||
if coord2: # 二判命中
|
||||
print(f"方案1")
|
||||
cx2, cy2 = coord2[0]
|
||||
print(f"添加评论:{cx2, cy2}")
|
||||
session.tap(int(cx2 / 3), int(cy2 / 3))
|
||||
print(f"点击添加评论的坐标:{int(cx2 / 3)}, {int(cy2 / 3)}")
|
||||
|
||||
session.send_keys(f"{single_comment}\n")
|
||||
# session.send_keys(f"hello\n")
|
||||
time.sleep(2)
|
||||
LogManager.method_info("评论成功", "养号", udid)
|
||||
else:
|
||||
time.sleep(1)
|
||||
print(f"方案2")
|
||||
img = session.screenshot()
|
||||
filePath = os.path.join(os.path.dirname(filePath), "bgv_comment.png")
|
||||
img.save(filePath)
|
||||
coord3 = OCRUtils.find_template(str(self.comment_add_dir2), filePath)
|
||||
if coord3: # 二判命中
|
||||
cx3, cy3 = coord3[0]
|
||||
session.tap(int(cx3 / 3), int(cy3 / 3))
|
||||
session.send_keys(f"{single_comment}\n")
|
||||
time.sleep(2)
|
||||
LogManager.method_info("评论成功", "养号", udid)
|
||||
|
||||
# 点返回/取消按钮:优先用推荐按钮坐标,没有就兜底 100,100
|
||||
tap_x = int(recomend_cx) if recomend_cx else 100
|
||||
tap_y = int(recomend_cy) if recomend_cy else 100
|
||||
session.tap(tap_x, tap_y)
|
||||
time.sleep(1)
|
||||
session.tap(tap_x, tap_y)
|
||||
|
||||
|
||||
# 养号
|
||||
def growAccount(self, udid, event, is_monitoring=False):
|
||||
|
||||
Reference in New Issue
Block a user