|
@@ -52,14 +52,50 @@ 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:
|
|
|
+ cursor = connection.cursor()
|
|
|
+ ucode_data = ('823C01552AA',
|
|
|
+ '823C01550AA',
|
|
|
+ '823C01850XA',
|
|
|
+ '730201350AA',
|
|
|
+ '730201350AA',
|
|
|
+ '730201450AA',
|
|
|
+ '730201450MA',
|
|
|
+ '72V201252AA',
|
|
|
+ '72V201253AA',
|
|
|
+ '72V201353AA',
|
|
|
+ '72V201354AA',
|
|
|
+ '72V201355AA',
|
|
|
+ '72V201254AA')
|
|
|
+ sql1 = 'UPDATE `uid_set` SET is_human=1 WHERE ucode in {} AND is_human=0;'.format(ucode_data)
|
|
|
+ cursor.execute(sql1)
|
|
|
+ connection.commit()
|
|
|
+ sql2 = "UPDATE `uid_set` SET mobile_4g=1 WHERE ucode='72V201254AA' AND mobile_4g=0;"
|
|
|
+ cursor.execute(sql2)
|
|
|
+ connection.commit()
|
|
|
+ cursor.close() # 执行完,关闭
|
|
|
+ connection.close()
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, repr(e))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def delAppLog(response):
|
|
|
"""
|
|
|
定时删除app日志
|
|
|
@param response: 响应对象
|
|
@@ -68,7 +104,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()
|