Skip to content

Commit

Permalink
移除时间hard code
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawnsdaddy committed Sep 10, 2024
1 parent 9b45662 commit 2556362
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
38 changes: 11 additions & 27 deletions arknights_mower/__main__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
from datetime import datetime, timedelta
from datetime import datetime

from arknights_mower.solvers.base_schedule import BaseSchedulerSolver
from arknights_mower.solvers.reclamation_algorithm import ReclamationAlgorithm
from arknights_mower.solvers.secret_front import SecretFront
from arknights_mower.utils import config, path, rapidocr
from arknights_mower.utils.csleep import MowerExit
from arknights_mower.utils.datetime import format_time
from arknights_mower.utils.datetime import format_time, get_server_time
from arknights_mower.utils.depot import 创建csv, 创建json
from arknights_mower.utils.device.adb_client.session import Session
from arknights_mower.utils.device.scrcpy import Scrcpy
Expand Down Expand Up @@ -218,50 +218,34 @@ def simulate(saved):
# 刷新时间以鹰历为准
# if (
# base_scheduler.sign_in
# < (datetime.now() - timedelta(hours=4)).date()
# < get_server_time().date()
# ):
# if base_scheduler.sign_in_plan_solver():
# base_scheduler.sign_in = (
# datetime.now() - timedelta(hours=4)
# ).date()

if (
base_scheduler.daily_visit_friend
< (datetime.now() - timedelta(hours=4)).date()
):
if base_scheduler.daily_visit_friend < get_server_time().date():
if base_scheduler.visit_friend_plan_solver():
base_scheduler.daily_visit_friend = (
datetime.now() - timedelta(hours=4)
).date()
base_scheduler.daily_visit_friend = get_server_time().date()

if (
base_scheduler.daily_report
< (datetime.now() - timedelta(hours=4)).date()
):
if base_scheduler.daily_report < get_server_time().date():
if base_scheduler.report_plan_solver():
base_scheduler.daily_report = (
datetime.now() - timedelta(hours=4)
).date()
base_scheduler.daily_report = get_server_time().date()

if (
config.conf.skland_enable
and base_scheduler.daily_skland
< (datetime.now() - timedelta(hours=4)).date()
and base_scheduler.daily_skland < get_server_time().date()
):
if base_scheduler.skland_plan_solover():
base_scheduler.daily_skland = (
datetime.now() - timedelta(hours=4)
).date()
base_scheduler.daily_skland = get_server_time().date()

if (
config.conf.check_mail_enable
and base_scheduler.daily_mail
< (datetime.now() - timedelta(hours=8)).date()
and base_scheduler.daily_mail < get_server_time().date()
):
if base_scheduler.mail_plan_solver():
base_scheduler.daily_mail = (
datetime.now() - timedelta(hours=8)
).date()
base_scheduler.daily_mail = get_server_time().date()

if config.conf.recruit_enable:
base_scheduler.recruit_plan_solver()
Expand Down
4 changes: 4 additions & 0 deletions arknights_mower/utils/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def get_server_weekday():
return datetime.now(pytz.timezone("Asia/Dubai")).weekday()


def get_server_time():
return datetime.now(pytz.timezone("Asia/Dubai"))


# newbing说用这个来定义休息时间省事
def format_time(seconds):
if seconds < 0: # 权宜之计 配合刷生息演算
Expand Down

0 comments on commit 2556362

Please sign in to comment.