diff --git a/config/config.json b/config/config.json index d0efee1..6543338 100644 --- a/config/config.json +++ b/config/config.json @@ -213,7 +213,7 @@ "fansclub_auto_join_wait_seconds": 5.0, "fansclub_manual_wait_seconds": 3.0, "enable_streaming_screenshot": false, - "yanghao_only": true, + "yanghao_only": false, "record_room_title_mapping_enabled": true, "high_value_fudai_poll_before_seconds": 10.0, "high_value_room_revisit_min_interval_seconds": 300, diff --git a/douyin/core/douyin_fudai.py b/douyin/core/douyin_fudai.py index 221c478..52c72ac 100644 --- a/douyin/core/douyin_fudai.py +++ b/douyin/core/douyin_fudai.py @@ -483,15 +483,27 @@ class fudai_analyse: try: interval = int(getattr(self, "yanghao_recommend_interval_seconds", 0) or 0) if interval <= 0: + try: + self._log_kv("养号", "未触发:yanghao_recommend_interval_seconds<=0", interval=interval) + except Exception: + print(f"[养号] 未触发:yanghao_recommend_interval_seconds<=0 interval={interval}") return # 不在等待开奖期间触发养号 if getattr(self, "_waiting_for_lottery_result", False): + try: + self._log_kv("养号", "未触发:正在等待开奖结果", waiting_for_lottery=True) + except Exception: + print("[养号] 未触发:正在等待开奖结果") return # 如果正在处理预约或有未完成的预约队列,则跳过触发 try: if getattr(self, "_current_attending_reservation_fudai", False): + try: + self._log_kv("养号", "未触发:当前正在处理预约参与", attending_reservation=True) + except Exception: + print("[养号] 未触发:当前正在处理预约参与") return except Exception: pass @@ -500,6 +512,10 @@ class fudai_analyse: reservations = getattr(self, "reservations", None) if reservations and len(reservations) > 0: # 有预约队列,等待预约完成 + try: + self._log_kv("养号", "未触发:存在预约队列,跳过养号", reservations=len(reservations)) + except Exception: + print(f"[养号] 未触发:存在预约队列 count={len(reservations)}") return except Exception: pass @@ -510,6 +526,14 @@ class fudai_analyse: ) if reservation_focus_until > time.time(): # 当前处于预约焦点期,跳过养号 + try: + self._log_kv( + "养号", + "未触发:处于预约焦点期", + reservation_focus_until=reservation_focus_until, + ) + except Exception: + print(f"[养号] 未触发:处于预约焦点期 until={reservation_focus_until}") return except Exception: pass @@ -517,6 +541,16 @@ class fudai_analyse: now = time.time() last = float(getattr(self, "_last_yanghao_ts", 0.0) or 0.0) if now - last < interval: + try: + self._log_kv( + "养号", + "未触发:距离上次养号未到间隔", + last_yanghao_ts=last, + interval=interval, + since_last=round(now - last, 2), + ) + except Exception: + print(f"[养号] 未触发:since_last={now-last:.2f}s interval={interval}s last={last}") return try: diff --git a/douyin/logging/douyin_logging_wrapper.py b/douyin/logging/douyin_logging_wrapper.py index 12f9fa2..62d7c29 100644 --- a/douyin/logging/douyin_logging_wrapper.py +++ b/douyin/logging/douyin_logging_wrapper.py @@ -441,11 +441,17 @@ class LoggingWrapper: elapsed_seconds = None try: if "elapsed_ms" in fields: - elapsed_seconds = float(fields.get("elapsed_ms", 0)) / 1000.0 + elapsed_seconds = ( + float(fields.get("elapsed_ms", 0)) / 1000.0 + ) elif "total_ms" in fields: - elapsed_seconds = float(fields.get("total_ms", 0)) / 1000.0 + elapsed_seconds = ( + float(fields.get("total_ms", 0)) / 1000.0 + ) elif "elapsed_seconds" in fields: - elapsed_seconds = float(fields.get("elapsed_seconds", 0)) + elapsed_seconds = float( + fields.get("elapsed_seconds", 0) + ) elif "seconds" in fields: elapsed_seconds = float(fields.get("seconds", 0)) except Exception: @@ -461,9 +467,16 @@ class LoggingWrapper: op_name = tag if tag else "操作" details = msg if msg else None if elapsed_seconds is not None: - _action_logger.log_operation(op_name, details or "", elapsed=elapsed_seconds, **extra) + _action_logger.log_operation( + op_name, + details or "", + elapsed=elapsed_seconds, + **extra, + ) else: - _action_logger.log_operation(op_name, details or "", **extra) + _action_logger.log_operation( + op_name, details or "", **extra + ) except Exception: pass except Exception: diff --git a/douyin/other/douyin_yanghao.py b/douyin/other/douyin_yanghao.py index ccc76e1..8ba5302 100644 --- a/douyin/other/douyin_yanghao.py +++ b/douyin/other/douyin_yanghao.py @@ -394,13 +394,13 @@ def yanghao_idle(analyser, total_seconds: int) -> None: and random.random() < float(getattr(analyser, "yanghao_like_prob", 0) or 0) ): - _scaled_click( - analyser, - int(getattr(analyser, "yanghao_like_icon_x", 0) or 0), - int(getattr(analyser, "yanghao_like_icon_y", 0) or 0), - ) - did_like = True - analyser.operation.delay(1.0) # 延迟1秒 + _scaled_click( + analyser, + int(getattr(analyser, "yanghao_like_icon_x", 0) or 0), + int(getattr(analyser, "yanghao_like_icon_y", 0) or 0), + ) + did_like = True + analyser.operation.delay(1.0) # 延迟1秒 print( "[养号] 动作: 点爱心(prob={})".format( getattr(analyser, "yanghao_like_prob", 0)