修复重复签到bug
This commit is contained in:
@@ -175,13 +175,21 @@ class SignInSystem:
|
||||
wx_nick_name = self.all_contacts.get(message.sender, message.sender)
|
||||
|
||||
# 判断用户是否已经签到过
|
||||
if user_record and user_record['sign_stat'] and user_record['sign_stat'] >= today_start:
|
||||
self.wcf.send_text(
|
||||
f"@{wx_nick_name} 您今天已经签到过了!当前积分:{user_record['points']}",
|
||||
(message.roomid if message.from_group() else message.sender),
|
||||
message.sender
|
||||
)
|
||||
return
|
||||
if user_record and user_record.get('sign_stat'):
|
||||
sign_stat = user_record['sign_stat']
|
||||
|
||||
# 确保 sign_stat 和 today_start 是同一时区对象
|
||||
if isinstance(sign_stat, datetime) and sign_stat.tzinfo is None:
|
||||
sign_stat = pytz.timezone(self.timezone).localize(sign_stat)
|
||||
|
||||
# 如果 sign_stat 已经大于或等于今天的零点,则认为用户已经签到过了
|
||||
if sign_stat >= today_start:
|
||||
self.wcf.send_text(
|
||||
f"@{wx_nick_name} 您今天已经签到过了!当前积分:{user_record['points']}",
|
||||
(message.roomid if message.from_group() else message.sender),
|
||||
message.sender
|
||||
)
|
||||
return
|
||||
|
||||
streak = 0
|
||||
if user_record and user_record['sign_stat']:
|
||||
|
||||
Reference in New Issue
Block a user