refactor: 优化代码格式,提升可读性
This commit is contained in:
1 parent
fb0c07c91a
commit
6ecd9fa1ae
7 files changed
+125
-61
No files matched your search
@@ -310,7 +310,9 @@ class fudai_analyse:
|
||||
self._just_switched_room: bool = False # 是否刚刚切换了直播间
|
||||
|
||||
# 高价值房间重访相关状态
|
||||
self._last_high_value_revisit_ts: float = time.time() # 最后一次重访时间戳,初始化为当前时间避免启动后立即重访
|
||||
self._last_high_value_revisit_ts: float = (
|
||||
time.time()
|
||||
) # 最后一次重访时间戳,初始化为当前时间避免启动后立即重访
|
||||
self._current_run_revisit_count: int = 0 # 本次运行的重访次数
|
||||
self._current_run_high_value_rooms: list[dict[str, Any]] = (
|
||||
[]
|
||||
@@ -1604,7 +1606,9 @@ class fudai_analyse:
|
||||
|
||||
def _seek_reservation_room(item: dict) -> bool:
|
||||
try:
|
||||
return bool(self._seek_reservation_room(item, operation_type="预约"))
|
||||
return bool(
|
||||
self._seek_reservation_room(item, operation_type="预约")
|
||||
)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@@ -2046,8 +2050,12 @@ class fudai_analyse:
|
||||
analyser=self,
|
||||
revisit_enabled=revisit_enabled,
|
||||
only_current_run=only_current_run,
|
||||
min_interval_seconds=getattr(self, "high_value_room_revisit_min_interval_seconds", 300),
|
||||
max_revisit_per_run=getattr(self, "high_value_room_revisit_max_per_run", 5),
|
||||
min_interval_seconds=getattr(
|
||||
self, "high_value_room_revisit_min_interval_seconds", 300
|
||||
),
|
||||
max_revisit_per_run=getattr(
|
||||
self, "high_value_room_revisit_max_per_run", 5
|
||||
),
|
||||
)
|
||||
|
||||
if should_revisit:
|
||||
@@ -2055,8 +2063,12 @@ class fudai_analyse:
|
||||
candidates = douyin_high_value_room.get_revisit_candidates(
|
||||
analyser=self,
|
||||
only_current_run=only_current_run,
|
||||
min_prize_value=getattr(self, "high_value_room_revisit_min_prize_value", 0.0),
|
||||
max_age_days=getattr(self, "high_value_room_revisit_max_age_days", 30),
|
||||
min_prize_value=getattr(
|
||||
self, "high_value_room_revisit_min_prize_value", 0.0
|
||||
),
|
||||
max_age_days=getattr(
|
||||
self, "high_value_room_revisit_max_age_days", 30
|
||||
),
|
||||
)
|
||||
|
||||
if candidates:
|
||||
@@ -2522,7 +2534,9 @@ class fudai_analyse:
|
||||
"""
|
||||
return douyin_swipe_handler.SwipeHandler.maybe_reset_after_swipes(self)
|
||||
|
||||
def _seek_reservation_room(self, item: dict[str, Any], operation_type: str = "预约") -> bool:
|
||||
def _seek_reservation_room(
|
||||
self, item: dict[str, Any], operation_type: str = "预约"
|
||||
) -> bool:
|
||||
"""根据预约记录里的 pos_seen 与当前 room_pos 进行回退,靠近目标直播间。
|
||||
|
||||
说明:
|
||||
@@ -2842,7 +2856,9 @@ class fudai_analyse:
|
||||
# 注意:basic_join_decision 内部已经关闭详情并切换直播间,不需要再次关闭
|
||||
try:
|
||||
douyin_fudai_core.basic_join_decision(
|
||||
self, detail, skip_result=(skip, skip_reason)
|
||||
self,
|
||||
detail,
|
||||
skip_result=(skip, skip_reason),
|
||||
)
|
||||
except Exception as e:
|
||||
try:
|
||||
@@ -3277,7 +3293,9 @@ class fudai_analyse:
|
||||
elapsed_seconds=round(elapsed, 2),
|
||||
)
|
||||
return
|
||||
join_result = douyin_fudai_core.basic_join_decision(self, detail, skip_result=(False, "already_checked_in_step3"))
|
||||
join_result = douyin_fudai_core.basic_join_decision(
|
||||
self, detail, skip_result=(False, "already_checked_in_step3")
|
||||
)
|
||||
|
||||
# 检查是否参与成功:如果 _last_successful_attend_ts 刚刚更新,说明参与成功
|
||||
attend_after_ts = getattr(self, "_last_successful_attend_ts", 0.0) or 0.0
|
||||
|
||||
Reference in new issue
Block a user