feat: 优化滑动切换逻辑,增强福袋信息处理和推荐页返回流程的可靠性
This commit is contained in:
1 parent
3edbd9a293
commit
5bf07f60c6
1 file changed
+24
-22
@@ -104,6 +104,16 @@ class SwipeHandler:
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
# 如果当前位置已含有福袋信息,跳过立即上滑切换,让后续流程继续执行
|
||||
try:
|
||||
analyser._log_kv( # type: ignore[attr-defined]
|
||||
"预约",
|
||||
"[预约] 已跳过重复记录,暂停上滑切换以完成后续流程",
|
||||
room_pos=room_pos,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -300,30 +310,22 @@ class SwipeHandler:
|
||||
except Exception:
|
||||
analyser.operation.delay(0.8)
|
||||
|
||||
# 尝试确认是否已回到推荐页;若不在推荐页,则兜底走原来的“多次返回到推荐页”逻辑
|
||||
# 为了提高可靠性:统一使用多次返回键直至到达推荐页的逻辑(比单次判断更稳健)
|
||||
try:
|
||||
ok = analyser.operation.get_screenshot(
|
||||
analyser.device_id, use_service=False
|
||||
)
|
||||
if ok:
|
||||
stage, seen = analyser._diagnose_stage_from_current_screen() # type: ignore[attr-defined]
|
||||
if stage != "RECOMMEND_PAGE":
|
||||
try:
|
||||
analyser._log_kv( # type: ignore[attr-defined]
|
||||
"流程",
|
||||
"返回键回退后未到推荐页,兜底返回推荐页并重进直播",
|
||||
stage=stage,
|
||||
seen=seen,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
SwipeHandler.return_to_recommend_and_reenter_live(analyser)
|
||||
else:
|
||||
SwipeHandler._reenter_live_from_recommend(analyser)
|
||||
else:
|
||||
SwipeHandler.return_to_recommend_and_reenter_live(analyser)
|
||||
except Exception:
|
||||
# 尝试先短延迟等待界面变化,再调用完整返回流程以确保到达推荐页
|
||||
try:
|
||||
analyser.operation.delay(
|
||||
getattr(analyser, "RETURN_STEP_DELAY_SECONDS", 0.8)
|
||||
)
|
||||
except Exception:
|
||||
time.sleep(0.8)
|
||||
SwipeHandler.return_to_recommend_and_reenter_live(analyser)
|
||||
except Exception:
|
||||
# 如果完整流程也失败,仍然兜底尝试重新进入
|
||||
try:
|
||||
SwipeHandler._reenter_live_from_recommend(analyser)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
rx = int(getattr(analyser, "resolution_ratio_x", 1080) or 1080)
|
||||
|
||||
Reference in new issue
Block a user