|
@@ -52,10 +52,9 @@ class CronDelDataView(View):
|
|
|
try:
|
|
|
cursor = connection.cursor()
|
|
|
# 删除7天前的数据
|
|
|
- now_time = int(time.time())
|
|
|
- last_month = LocalDateTimeUtil.get_before_days_timestamp(now_time, 7)
|
|
|
+ last_week = LocalDateTimeUtil.get_last_week()
|
|
|
sql = 'DELETE FROM access_log WHERE time < %s limit %s'
|
|
|
- cursor.execute(sql, [last_month, 10000])
|
|
|
+ cursor.execute(sql, [last_week, 10000])
|
|
|
# 关闭游标
|
|
|
cursor.close()
|
|
|
connection.close()
|