From 3ebff7beb49599a38e9865dbf33e7b6e2ce8733e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 26 Nov 2020 21:00:18 +0800 Subject: [PATCH] 1 --- server/mailsender_py/mailsender.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/mailsender_py/mailsender.py b/server/mailsender_py/mailsender.py index 80b3a02..23cb606 100644 --- a/server/mailsender_py/mailsender.py +++ b/server/mailsender_py/mailsender.py @@ -148,11 +148,11 @@ def fetchEventTimerFunc(refresh_time): def done_callback(): f7.timer.callLater(refresh_time, lambda : fetchEventTimerFunc(refresh_time)) +# dailyMail() f7.app.createAsyncTask(done_callback, fetchEvent, ()) def dailyMail(): print('dailyMail') - return mysql_cluster_conf = json.loads(open(CONFIG_DIR + '/mailsender.mysql.cluster.json', 'r').read()) nowtime = time.time() for conf in mysql_cluster_conf: @@ -164,7 +164,7 @@ def dailyMail(): charset = 'utf8' ) cursor = conn.cursor() - last_idx = db_idx_hash.get(conf['instance_id'], 0) + last_idx = 0 while True: cursor.execute('SELECT idx, accountid, vip_lv, privi_lv, createtime, modifytime, ' ' privi_daily_mail_lasttime, vip_weekly_mail_lasttime ' @@ -178,6 +178,7 @@ def dailyMail(): for row in cursor: has_data = True last_idx = max(row[0], last_idx) + idx = row[0] account_id = row[1] vip_lv = row[2] privi_lv = row[3] @@ -186,12 +187,12 @@ def dailyMail(): privi_daily_mail_lasttime = row[6] vip_weekly_mail_lasttime = row[7] if privi_daily_mail_lasttime <= 0 or \ - q7.getDaySeconds(nowtime()) > q7.getDaySeconds(privi_daily_mail_lasttime): + q7.getDaySeconds(nowtime) > q7.getDaySeconds(privi_daily_mail_lasttime): if privi_lv > 0: sendPriviDailyMail(account_id, privi_lv) handled_privi_idx.append(idx) if vip_weekly_mail_lasttime <= 0 or \ - q7.getMondaySeconds(nowtime()) > q7.getMondaySeconds(vip_weekly_mail_lasttime): + q7.getMondaySeconds(nowtime) > q7.getMondaySeconds(vip_weekly_mail_lasttime): if vip_lv > 0: sendVipWeeklyMail(account_id, vip_lv) handled_vip_idx.append(idx)