事先声明,我不确定改完的逻辑正确
This commit is contained in:
parent
da31bcdc48
commit
ba7b9a61d5
68
main.py
68
main.py
@ -68,10 +68,22 @@ class TimeChecker:
|
||||
self.rest_lst.append((start_time, end_time))
|
||||
logger.info("时间检查器初始化完成")
|
||||
|
||||
def rest_last_time(self) -> int:
|
||||
"""课间剩多久"""
|
||||
if not self.during_rest():
|
||||
return 0
|
||||
now = datetime.datetime.now()
|
||||
now_rest = [end_time for start_time, end_time in self.rest_lst if start_time <= now <= end_time]
|
||||
if not now_rest:
|
||||
return 0
|
||||
return (now_rest[0] - now).seconds
|
||||
|
||||
def rest_time(self) -> int: ...
|
||||
|
||||
def class_time(self) -> int: ...
|
||||
def during_rest(self) -> bool:
|
||||
now = datetime.datetime.now()
|
||||
return any(start_time <= now <= end_time for start_time, end_time in self.rest_lst)
|
||||
|
||||
def is_during_class(self) -> int: ...
|
||||
|
||||
|
||||
TIME_CHCKER = TimeChecker()
|
||||
@ -1531,16 +1543,10 @@ def choice(fromwhere):
|
||||
try:
|
||||
try:
|
||||
if zz != fi[1]:
|
||||
if rest():
|
||||
on_button_click(
|
||||
"人名单文件的sha256值\n与上次不一致。\n请确认人名单是否被篡改。\n按确定以继续。",
|
||||
"",
|
||||
)
|
||||
elif not rest():
|
||||
on_button_click(
|
||||
"人名单文件的sha256值\n与上次不一致。\n请确认人名单是否被篡改。\n按确定以继续。",
|
||||
"pppp",
|
||||
)
|
||||
on_button_click(
|
||||
"人名单文件的sha256值\n与上次不一致。\n请确认人名单是否被篡改。\n按确定以继续。",
|
||||
"" if TIME_CHCKER.during_rest() else "pppp",
|
||||
)
|
||||
else:
|
||||
password = True
|
||||
except:
|
||||
@ -1548,7 +1554,7 @@ def choice(fromwhere):
|
||||
password = True
|
||||
except:
|
||||
pass
|
||||
if rest() or (not rest() and password):
|
||||
if TIME_CHCKER.during_rest() or password:
|
||||
logger.info("人名单sha256:" + file_sha256(NAME_LST_PATH))
|
||||
logger.info(f"当前有{len(g_list)}人")
|
||||
password = False
|
||||
@ -1565,20 +1571,14 @@ def choice(fromwhere):
|
||||
sha = file_sha256(r"support/record.txt") + "\n"
|
||||
try:
|
||||
if ooo != sha:
|
||||
if rest():
|
||||
on_button_click(
|
||||
"抽中记录的sha256值\n与上次不一致。\n请确认记录是否被篡改。\n按确定以继续。",
|
||||
"",
|
||||
)
|
||||
elif not rest():
|
||||
on_button_click(
|
||||
"抽中记录的sha256值\n与上次不一致。\n请确认记录是否被篡改。\n按确定以继续。",
|
||||
"pppp",
|
||||
)
|
||||
on_button_click(
|
||||
"抽中记录的sha256值\n与上次不一致。\n请确认记录是否被篡改。\n按确定以继续。",
|
||||
"" if TIME_CHCKER.during_rest() else "pppp",
|
||||
)
|
||||
else:
|
||||
password = True
|
||||
if (rest()) or (not rest() and password):
|
||||
logger.info(f'操作后sha256:{file_sha256(r"support/record.txt")}')
|
||||
if TIME_CHCKER.during_rest() or password:
|
||||
logger.info(f"操作后sha256:{file_sha256(r'support/record.txt')}")
|
||||
password = False
|
||||
except:
|
||||
pass
|
||||
@ -1593,19 +1593,13 @@ def choice(fromwhere):
|
||||
sha = file_sha256(r"support/journal.log") + "\n"
|
||||
try:
|
||||
if jourlog != sha:
|
||||
if rest():
|
||||
on_button_click(
|
||||
"日志的sha256值\n与程序自动操作的不一致。\n请确认记录是否被篡改。\n按确定以继续。",
|
||||
"",
|
||||
)
|
||||
elif not rest():
|
||||
on_button_click(
|
||||
"日志的sha256值\n与程序自动操作的不一致。\n请确认记录是否被篡改。\n按确定以继续。",
|
||||
"pppp",
|
||||
)
|
||||
on_button_click(
|
||||
"日志的sha256值\n与程序自动操作的不一致。\n请确认记录是否被篡改。\n按确定以继续。",
|
||||
"" if TIME_CHCKER.during_rest() else "pppp",
|
||||
)
|
||||
else:
|
||||
password = True
|
||||
if (rest()) or (not rest() and password):
|
||||
if TIME_CHCKER.during_rest() or password:
|
||||
password = False
|
||||
except:
|
||||
pass
|
||||
@ -2108,4 +2102,4 @@ t3 = threading.Thread(target=bsy, name="bsy")
|
||||
t1.start() # 开始运行t1线程
|
||||
time.sleep(5)
|
||||
t2.start() # 开始运行t2线程
|
||||
# t3.start()
|
||||
t3.start()
|
||||
|
Loading…
Reference in New Issue
Block a user