放宽时间窗口:peak-4h 到 peak+2h(6小时)

This commit is contained in:
2569718930@qq.com
2026-05-13 01:13:07 +08:00
parent cfb746300a
commit 9adcfdb203
+3 -3
View File
@@ -863,9 +863,9 @@ def _in_peak_time_window(city_weather: Dict[str, Any]) -> bool:
try:
current_h, current_m = int(local_time[:2]), int(local_time[3:5])
current_minutes = current_h * 60 + current_m
# Window: first_h - 2h to last_h + 1.5h
start_min = max(0, (first_h - 2) * 60)
end_min = min(24 * 60 - 1, int((last_h + 1.5) * 60))
# Window: first_h - 4h to last_h + 2h
start_min = max(0, (first_h - 4) * 60)
end_min = min(24 * 60 - 1, (last_h + 2) * 60)
return start_min <= current_minutes <= end_min
except Exception:
return False