feat: 优化代码格式,提升可读性和一致性

This commit is contained in:
Your Name committed 2026-01-06 22:39:58 +08:00
1 parent 68295e564e
commit c6eb76845f
7 files changed
+82 -36

No files matched your search

+6 -2
View File
@@ -2318,7 +2318,9 @@ class fudai_analyse:
self.operation.delay(self.ENTER_LIVE_CLICK_DELAY)
# 小延迟,避免界面卡顿导致第二次点击未生效
try:
self.operation.delay(getattr(self, "RETURN_STEP_DELAY_SECONDS", 0.8))
self.operation.delay(
getattr(self, "RETURN_STEP_DELAY_SECONDS", 0.8)
)
except Exception:
self.operation.delay(0.8)
self.operation.click(self.device_id, enter_live_x, enter_live_y)
@@ -2332,7 +2334,9 @@ class fudai_analyse:
# 进入后等待(保留原有最终等待)
try:
# 小延迟,确保界面就绪(可配置)
self.operation.delay(getattr(self, "RETURN_STEP_DELAY_SECONDS", 0.8))
self.operation.delay(
getattr(self, "RETURN_STEP_DELAY_SECONDS", 0.8)
)
except Exception:
self.operation.delay(0.8)
self.operation.delay(self.ENTER_LIVE_FINAL_DELAY)
+15 -5
View File
@@ -250,7 +250,9 @@ class SwipeHandler:
# 小延迟,避免卡顿导致下一步截图/判断失败
try:
analyser.operation.delay(getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8))
analyser.operation.delay(
getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8)
)
except Exception:
analyser.operation.delay(0.8)
@@ -290,7 +292,9 @@ class SwipeHandler:
# 标记:本轮处于重置/回退流程中,防止其他路径触发返回键退出
try:
setattr(analyser, "_recent_reset_ts", time.time())
setattr(analyser, "_recent_reset_by", "reset_after_swipes_swipe")
setattr(
analyser, "_recent_reset_by", "reset_after_swipes_swipe"
)
except Exception:
pass
# 向上回退:从上往下滑动(start_y < end_y)
@@ -329,7 +333,9 @@ class SwipeHandler:
# 注意:这里使用 ADB 直调绕过了 operation.swipe,需要手动标记页面已变化
try:
if hasattr(analyser.operation, "_mark_screen_dirty"):
analyser.operation._mark_screen_dirty(analyser.device_id)
analyser.operation._mark_screen_dirty(
analyser.device_id
)
except Exception:
pass
except Exception:
@@ -397,7 +403,9 @@ class SwipeHandler:
# 小延迟,等待页面卡顿恢复再点击进入
try:
analyser.operation.delay(getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8))
analyser.operation.delay(
getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8)
)
except Exception:
analyser.operation.delay(0.8)
@@ -412,7 +420,9 @@ class SwipeHandler:
# 点击间隔稍微加长,避免卡顿导致第二次点击未生效
try:
analyser.operation.delay(getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8))
analyser.operation.delay(
getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8)
)
except Exception:
analyser.operation.delay(0.8)
+9 -3
View File
@@ -888,12 +888,16 @@ def yanghao_check_and_recover_from_desktop(analyser) -> bool:
print(f"[养号] 点击进入直播间 -> ({ex},{ey}) 连点两次")
analyser.click(ex, ey)
try:
analyser.operation.delay(getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8))
analyser.operation.delay(
getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8)
)
except Exception:
analyser.operation.delay(0.8)
analyser.click(ex, ey)
try:
analyser.operation.delay(getattr(analyser, "ENTER_LIVE_FINAL_DELAY", 2.0))
analyser.operation.delay(
getattr(analyser, "ENTER_LIVE_FINAL_DELAY", 2.0)
)
except Exception:
analyser.operation.delay(2.0)
except Exception:
@@ -967,7 +971,9 @@ def yanghao_recommend_flow(analyser, total_seconds: int) -> None:
print("[养号] step5: 坐标点击进入直播间 -> ({},{}) 连点两次".format(ex, ey))
analyser.click(ex, ey)
try:
analyser.operation.delay(getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8))
analyser.operation.delay(
getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8)
)
except Exception:
analyser.operation.delay(0.8)
analyser.click(ex, ey)