|
@@ -7,6 +7,7 @@
|
|
@Software: PyCharm
|
|
@Software: PyCharm
|
|
"""
|
|
"""
|
|
import logging
|
|
import logging
|
|
|
|
+import time
|
|
|
|
|
|
from django.views.generic.base import View
|
|
from django.views.generic.base import View
|
|
|
|
|
|
@@ -170,12 +171,14 @@ class AlgorithmShopView(View):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
status = int(status)
|
|
status = int(status)
|
|
type_id = int(type_id)
|
|
type_id = int(type_id)
|
|
|
|
+ now_time = int(time.time())
|
|
uid_algorithm_qs = DeviceUidAlgorithmType.objects.filter(algorithm_type_id=type_id, device_uid=uid)
|
|
uid_algorithm_qs = DeviceUidAlgorithmType.objects.filter(algorithm_type_id=type_id, device_uid=uid)
|
|
if not uid_algorithm_qs.exists():
|
|
if not uid_algorithm_qs.exists():
|
|
- param = {'algorithm_type_id': int(type_id), 'uid': uid, 'function': setting_json, 'status': status}
|
|
|
|
|
|
+ param = {'algorithm_type_id': int(type_id), 'uid': uid, 'function': setting_json,
|
|
|
|
+ 'status': status, 'updated_time': now_time, 'created_time': now_time}
|
|
DeviceUidAlgorithmType.objects.create(**param)
|
|
DeviceUidAlgorithmType.objects.create(**param)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
- uid_algorithm_qs.update(status=status, function=setting_json)
|
|
|
|
|
|
+ uid_algorithm_qs.update(status=status, function=setting_json, updated_time=now_time)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
print('保存算法设置异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
print('保存算法设置异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|