From a240ba852b671335986522019ed9ab428a943f90 Mon Sep 17 00:00:00 2001 From: baoliang Date: Wed, 18 Nov 2020 23:37:22 +0800 Subject: [PATCH] add message --- polls/tasks.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/polls/tasks.py b/polls/tasks.py index 4b88e47..9eba6fa 100644 --- a/polls/tasks.py +++ b/polls/tasks.py @@ -15,14 +15,16 @@ def process_notify_task(): now = datetime.now() if two_hours_later < now: phone = n.user.username + print(phone) today = now.date() hour = now.hour exists = SMSNotifyRecord.objects.filter( phone=phone, added=today, notice_id=n.id).exists() + print(exists) if exists: - return - if hour < 8 or hour > 20: - return + break + if hour < 8 or hour > 24: + break print('============', phone, n.type, n.id) SMSNotifyRecord.objects.create(phone=phone, notice_id=n.id) sent_sms_notify(phone, n.type)