优化代码逻辑,修复时间格式不正确导致的排序问题

This commit is contained in:
LibraHp_0928 2024-09-13 10:40:35 +08:00
parent 822e4b2f66
commit 238dc0d8f3
4 changed files with 4 additions and 3 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -28,8 +28,8 @@ def safe_strptime(date_str):
# 尝试按照指定格式解析日期 # 尝试按照指定格式解析日期
return datetime.strptime(date_str, "%Y年%m月%d%H:%M") return datetime.strptime(date_str, "%Y年%m月%d%H:%M")
except ValueError: except ValueError:
# 如果日期格式不对,返回 None # 如果日期格式不对,返回 datetime.max
return None return datetime.max
# 还原QQ空间网页版说说 # 还原QQ空间网页版说说
@ -140,6 +140,7 @@ def save_data():
open_file(current_directory + user_save_path[1:]) open_file(current_directory + user_save_path[1:])
os.system('pause') os.system('pause')
def open_file(file_path): def open_file(file_path):
# 检查操作系统 # 检查操作系统
if platform.system() == 'Windows': if platform.system() == 'Windows':

BIN
resource/.DS_Store vendored

Binary file not shown.

View File

@ -80,7 +80,7 @@ def get_login_user_info():
def get_message_count(): def get_message_count():
# 初始的总量范围 # 初始的总量范围
lower_bound = 0 lower_bound = 0
upper_bound = 100000 # 假设最大总量为1000000 upper_bound = 10000000 # 假设最大总量为1000000
total = upper_bound // 2 # 初始的总量为上下界的中间值 total = upper_bound // 2 # 初始的总量为上下界的中间值
with tqdm(desc="正在获取消息列表数量...") as pbar: with tqdm(desc="正在获取消息列表数量...") as pbar:
while lower_bound <= upper_bound: while lower_bound <= upper_bound: