🐛 修复时区错误

This commit is contained in:
CMHopeSunshine 2022-12-28 22:39:20 +08:00
parent a1900b1883
commit 0274bb7c6e
3 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ async def get_statistics(group_id: int):
member_id_list = [str(member['user_id']) for member in member_list]
info_list = [info for info in info_list if
info.user_id in member_id_list and info.total_battle and info.total_star and info.max_damage and info.max_take_damage]
now = datetime.datetime.now().replace(tzinfo=pytz.timezone('UTC'))
now = datetime.datetime.now().replace(tzinfo=pytz.timezone('Asia/Shanghai'))
info_list = [info for info in info_list if info.start_time <= now <= info.end_time]
if not info_list:
return '本群还没有深渊战斗数据哦!'

View File

@ -90,7 +90,7 @@ async def check_note():
if sub.today_remind_num <= limit_num and (
sub.last_remind_time is None or (sub.last_remind_time is not None and (
sub.last_remind_time + datetime.timedelta(minutes=30) <= datetime.datetime.now().replace(
tzinfo=pytz.timezone('UTC'))))):
tzinfo=pytz.timezone('Asia/Shanghai'))))):
data = await get_mihoyo_private_data(sub.uid, str(sub.user_id), 'daily_note')
if isinstance(data, str):
logger.info('原神实时便签', '', {'用户': sub.user_id, 'UID': sub.uid}, 'Cookie未绑定或已失效删除任务', False)

View File

@ -172,7 +172,7 @@ class GenshinInfoManager:
character = await Character.get_or_none(**query, data_source='enka')
if not character or character.update_time < (
datetime.datetime.now() - datetime.timedelta(hours=config.ysd_auto_update)).replace(
tzinfo=pytz.timezone('UTC')):
tzinfo=pytz.timezone('Asia/Shanghai')):
try:
await self.update_from_enka()
except Exception as e:
@ -204,7 +204,7 @@ class GenshinInfoManager:
player_info = await PlayerInfo.get_or_none(user_id=self.user_id, uid=self.uid)
if player_info is None or player_info.update_time is None or player_info.update_time < (
datetime.datetime.now() - datetime.timedelta(hours=config.ysa_auto_update)).replace(
tzinfo=pytz.timezone('UTC')):
tzinfo=pytz.timezone('Asia/Shanghai')):
result = await self.update_from_mihoyo()
if result != '更新成功':
return result, []
@ -221,7 +221,7 @@ class GenshinInfoManager:
player_info = await PlayerInfo.get_or_none(user_id=self.user_id, uid=self.uid)
if player_info is None or player_info.update_time is None or player_info.update_time < (
datetime.datetime.now() - datetime.timedelta(hours=config.ys_auto_update)).replace(
tzinfo=pytz.timezone('UTC')):
tzinfo=pytz.timezone('Asia/Shanghai')):
result = await self.update_from_mihoyo()
if result != '更新成功':
return result, None