调整时区,
This commit is contained in:
@@ -194,6 +194,11 @@ class SignInSystem:
|
|||||||
streak = 0
|
streak = 0
|
||||||
if user_record and user_record['sign_stat']:
|
if user_record and user_record['sign_stat']:
|
||||||
last_sign_date = user_record['sign_stat'].replace(hour=0, minute=0, second=0, microsecond=0)
|
last_sign_date = user_record['sign_stat'].replace(hour=0, minute=0, second=0, microsecond=0)
|
||||||
|
# 确保 sign_stat 和 today_start 是同一时区对象
|
||||||
|
if isinstance(last_sign_date, datetime) and last_sign_date.tzinfo is None:
|
||||||
|
last_sign_date = pytz.timezone(self.timezone).localize(last_sign_date)
|
||||||
|
print(f"last_sign_date:{last_sign_date}")
|
||||||
|
print(f"yesterday:{yesterday}")
|
||||||
if last_sign_date == yesterday:
|
if last_sign_date == yesterday:
|
||||||
streak = user_record['signin_streak'] + 1
|
streak = user_record['signin_streak'] + 1
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user