|
@@ -51,8 +51,9 @@ class CronDelDataView(View):
|
|
|
def delAccessLog(response):
|
|
|
try:
|
|
|
cursor = connection.cursor()
|
|
|
- # 删除一个月前的数据
|
|
|
- last_month = LocalDateTimeUtil.get_last_month()
|
|
|
+ # 删除7天前的数据
|
|
|
+ now_time = int(time.time())
|
|
|
+ last_month = LocalDateTimeUtil.get_before_days_timestamp(now_time, 7)
|
|
|
sql = 'DELETE FROM access_log WHERE time < %s limit %s'
|
|
|
cursor.execute(sql, [last_month, 10000])
|
|
|
# 关闭游标
|
|
@@ -239,7 +240,8 @@ class CronUpdateDataView(View):
|
|
|
Unused_Uid_Meal.objects.filter(id=unused['id']).delete()
|
|
|
StsCrdModel.objects.filter(
|
|
|
uid=expired_uid_bucket['uid']).delete() # 删除sts记录
|
|
|
- except Exception:
|
|
|
+ except Exception as e:
|
|
|
+ print(repr(e))
|
|
|
continue
|
|
|
return response.json(0)
|
|
|
|