|
@@ -55,14 +55,43 @@ class CronDelDataView(View):
|
|
|
elif operation == 'delTesterDevice': # 定时删除测试账号下的设备数据
|
|
|
return self.delTesterDevice(response)
|
|
|
elif operation == 'delAppLog': # 定时删除app日志
|
|
|
- return self.del_app_Log(response)
|
|
|
+ return self.delAppLog(response)
|
|
|
+ elif operation == 'UpdateConfiguration': # 定时更新配置
|
|
|
+ return self.UpdateConfiguration(response)
|
|
|
elif operation == 'cloud-log':
|
|
|
return self.uid_cloud_storage_upload_count(response)
|
|
|
else:
|
|
|
return response.json(404)
|
|
|
|
|
|
@staticmethod
|
|
|
- def del_app_Log(response):
|
|
|
+ def UpdateConfiguration(response):
|
|
|
+ """
|
|
|
+ 定时更新配置
|
|
|
+ @param response: 响应对象
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ ucode_list = ['823C01552AA',
|
|
|
+ '823C01550AA',
|
|
|
+ '823C01850XA',
|
|
|
+ '730201350AA',
|
|
|
+ '730201350AA',
|
|
|
+ '730201450AA',
|
|
|
+ '730201450MA',
|
|
|
+ '72V201252AA',
|
|
|
+ '72V201253AA',
|
|
|
+ '72V201353AA',
|
|
|
+ '72V201354AA',
|
|
|
+ '72V201355AA',
|
|
|
+ '72V201254AA']
|
|
|
+ UidSetModel.objects.filter(ucode__in=ucode_list, is_human=0).update(is_human=1)
|
|
|
+ UidSetModel.objects.filter(ucode='72V201254AA', mobile_4g=0).update(mobile_4g=1)
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, repr(e))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def delAppLog(response):
|
|
|
"""
|
|
|
定时删除app日志
|
|
|
@param response: 响应对象
|
|
@@ -71,7 +100,7 @@ class CronDelDataView(View):
|
|
|
nowTime = int(time.time())
|
|
|
try:
|
|
|
cursor = connection.cursor()
|
|
|
- month_ago_time = nowTime - 30 * 24 * 60 * 60 # 删除30天前的数据
|
|
|
+ month_ago_time = nowTime - 30 * 24 * 60 * 60 # 保留近30天的数据
|
|
|
sql = 'DELETE FROM `app_log` WHERE add_time<{}'.format(month_ago_time)
|
|
|
cursor.execute(sql)
|
|
|
cursor.close()
|