This commit is contained in:
aozhiwei 2020-11-26 21:00:18 +08:00
parent d73129ddc2
commit 3ebff7beb4

View File

@ -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)