Explorar o código

设备日志保留7天

locky hai 1 semana
pai
achega
4b513b7ae9
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      Controller/Cron/CronTaskController.py

+ 2 - 2
Controller/Cron/CronTaskController.py

@@ -451,9 +451,9 @@ class CronDelDataView(View):
         nowTime = int(time.time())
         try:
             cursor = connection.cursor()
-            month_ago_time = nowTime - 30 * 24 * 60 * 60  # 保留近30天的数据
+            expired_time = nowTime - 7 * 24 * 60 * 60  # 保留近7天的数据
 
-            sql = 'DELETE FROM `device_log` WHERE unix_timestamp(add_time)<{}'.format(month_ago_time)
+            sql = 'DELETE FROM `device_log` WHERE unix_timestamp(add_time)<{}'.format(expired_time)
             cursor.execute(sql)
             cursor.close()
             return response.json(0)