|
@@ -72,6 +72,8 @@ class CronDelDataView(View):
|
|
|
return self.uid_cloud_storage_upload_count(response)
|
|
|
elif operation == 'delDeviceLog': # 定时删除设备日志
|
|
|
return self.del_device_log(response)
|
|
|
+ elif operation == 'delCampaignsLogs':
|
|
|
+ return self.del_campaigns_log(response)
|
|
|
else:
|
|
|
return response.json(404)
|
|
|
|
|
@@ -397,6 +399,24 @@ class CronDelDataView(View):
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
|
|
+ @staticmethod
|
|
|
+ def del_campaigns_log(response):
|
|
|
+ """
|
|
|
+ 定时删除广告日志
|
|
|
+ @param response: 响应对象
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ nowTime = int(time.time())
|
|
|
+ try:
|
|
|
+ cursor = connection.cursor()
|
|
|
+ month_ago_time = nowTime - 90 * 24 * 60 * 60 # 保留近90天的数据
|
|
|
+ sql = f'DELETE FROM `open_screen_campaign` WHERE update_time<{month_ago_time}'
|
|
|
+ cursor.execute(sql)
|
|
|
+ cursor.close()
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+
|
|
|
|
|
|
class CronUpdateDataView(View):
|
|
|
def get(self, request, *args, **kwargs):
|