|
@@ -125,10 +125,11 @@ class DeviceManagement(View):
|
|
|
if not all([model, type, lang, name, sort]):
|
|
|
return response.json(444)
|
|
|
type = int(type)
|
|
|
+ nowTime = int(time.time())
|
|
|
|
|
|
try:
|
|
|
with transaction.atomic():
|
|
|
- # 判断包是否存在,并创建
|
|
|
+ # 判断包是否存在
|
|
|
new_bundle_list = []
|
|
|
for bundle_name in app_bundle_name:
|
|
|
if not bundle_name == '':
|
|
@@ -170,13 +171,29 @@ class DeviceManagement(View):
|
|
|
app_bundle_qs = AppBundle.objects.filter(id=app_id).values('id')
|
|
|
app_bundle_qs = app_bundle_qs[0]['id']
|
|
|
app_device_type_qs.appbundle_set.add(app_bundle_qs)
|
|
|
+ device_type_qs = DeviceTypeModel.objects.filter(model=model, type=type)
|
|
|
+ if device_type_qs.exists():
|
|
|
+ device_type_qs.update(updata_time=nowTime)
|
|
|
+ else:
|
|
|
+ DeviceTypeModel.objects.create(name=name, model=model, type=type, ptz_type=model, icon=fileName,
|
|
|
+ add_time=nowTime, update_time=nowTime)
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
return response.json(500, repr(e))
|
|
|
|
|
|
- @staticmethod
|
|
|
- def get_device_info_list(request_dict, response):
|
|
|
+ @classmethod
|
|
|
+ def add_device_type(cls, name, model, type, fileName):
|
|
|
+ nowTime = int(time.time())
|
|
|
+ data = {
|
|
|
+ 'name': name,
|
|
|
+ 'model': model,
|
|
|
+ 'type': type,
|
|
|
+ 'icon': fileName
|
|
|
+ }
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def get_device_info_list(cls, request_dict, response):
|
|
|
pageNo = request_dict.get('pageNo', None)
|
|
|
pageSize = request_dict.get('pageSize', None)
|
|
|
UID = request_dict.get('UID', None)
|
|
@@ -235,14 +252,17 @@ class DeviceManagement(View):
|
|
|
device_info_list["datas"][k]['fields']['Type'] = device_type_qs[0]['name']
|
|
|
uid_set_qs = UidSetModel.objects.filter(
|
|
|
uid=device_info_list["datas"][k]['fields']['UID']).values('is_alexa', 'ip', 'version',
|
|
|
- 'is_ai', 'is_human', 'cloud_vod')
|
|
|
+ 'is_ai', 'is_human', 'cloud_vod',
|
|
|
+ 'ucode', 'device_type')
|
|
|
if uid_set_qs.exists():
|
|
|
isAlexa = '是' if uid_set_qs[0]['is_alexa'] else '否'
|
|
|
isHuman = '是' if uid_set_qs[0]['is_human'] else '否'
|
|
|
- if uid_set_qs[0]['cloud_vod'] == 2:
|
|
|
- cloud_vod = '不支持'
|
|
|
- else:
|
|
|
+ cloud_vod = CommonService.is_cloud_device(uid_set_qs[0]['ucode'],
|
|
|
+ uid_set_qs[0]['device_type'])
|
|
|
+ if cloud_vod:
|
|
|
cloud_vod = '支持'
|
|
|
+ else:
|
|
|
+ cloud_vod = '不支持'
|
|
|
if uid_set_qs[0]['is_ai'] == 2:
|
|
|
isAI = '不支持'
|
|
|
elif uid_set_qs[0]['is_ai'] == 1:
|