|
@@ -1592,32 +1592,11 @@ class DeviceManagement(View):
|
|
|
supports_night_vision = request_dict.get('supportsNightVision', 0)
|
|
|
screen_channels = request_dict.get('screenChannels', None)
|
|
|
network_type = request_dict.get('networkType', None)
|
|
|
+ other_features = request_dict.get('otherFeatures', None)
|
|
|
electricity_statistics = request_dict.get('electricityStatistics', 0)
|
|
|
supports_pet_tracking = request_dict.get('supportsPetTracking', 0)
|
|
|
has_4g_cloud = request_dict.get('has4gCloud', -1)
|
|
|
|
|
|
- other_features_fields = [
|
|
|
- 'supports_lighting',
|
|
|
- 'is_support_multi_speed',
|
|
|
- 'supports_algorithm_switch',
|
|
|
- 'supports_playback_filtering'
|
|
|
- ]
|
|
|
-
|
|
|
- check_other_features = request_dict.get('otherFeatures', None)
|
|
|
- if check_other_features:
|
|
|
- try:
|
|
|
- other_features = json.loads(check_other_features)
|
|
|
- for field in other_features_fields:
|
|
|
- if field not in other_features or other_features[field] in (None, '', []):
|
|
|
- other_features[field] = -1
|
|
|
- LOGGER.info(f'设置 {field} 为默认值 -1')
|
|
|
-
|
|
|
- except json.JSONDecodeError:
|
|
|
- LOGGER.error(f"otherFeatures JSON 解析失败: {check_other_features}")
|
|
|
- return response.json(500, "json无效")
|
|
|
- else:
|
|
|
- other_features = {field: -1 for field in other_features_fields}
|
|
|
- LOGGER.info(f'未传入otherFeatures,创建默认值字典: {other_features}')
|
|
|
|
|
|
if not all([d_code, software_ver, video_code,
|
|
|
device_type, supports_alarm,
|
|
@@ -1627,6 +1606,10 @@ class DeviceManagement(View):
|
|
|
try:
|
|
|
now_time = int(time.time())
|
|
|
ai_type = int(ai_type)
|
|
|
+ if other_features:
|
|
|
+ other_features = json.loads(other_features)
|
|
|
+ else:
|
|
|
+ other_features = None
|
|
|
|
|
|
if DeviceVersionInfo.objects.filter(d_code=d_code, software_ver=software_ver).exists():
|
|
|
return response.json(174)
|
|
@@ -1687,38 +1670,22 @@ class DeviceManagement(View):
|
|
|
supports_night_vision = request_dict.get('supportsNightVision', 0)
|
|
|
screen_channels = request_dict.get('screenChannels', None)
|
|
|
network_type = request_dict.get('networkType', None)
|
|
|
+ other_features = request_dict.get('otherFeatures', None)
|
|
|
electricity_statistics = request_dict.get('electricityStatistics', 0)
|
|
|
supports_pet_tracking = request_dict.get('supportsPetTracking', 0)
|
|
|
has_4g_cloud = request_dict.get('has4gCloud', -1)
|
|
|
|
|
|
- other_features_fields = [
|
|
|
- 'supports_lighting',
|
|
|
- 'is_support_multi_speed',
|
|
|
- 'supports_algorithm_switch',
|
|
|
- 'supports_playback_filtering'
|
|
|
- ]
|
|
|
-
|
|
|
- check_other_features = request_dict.get('otherFeatures', None)
|
|
|
- if check_other_features:
|
|
|
- try:
|
|
|
- other_features = json.loads(check_other_features)
|
|
|
- for field in other_features_fields:
|
|
|
- if field not in other_features or other_features[field] in (None, '', []):
|
|
|
- other_features[field] = -1
|
|
|
- LOGGER.info(f'设置 {field} 为默认值 -1')
|
|
|
-
|
|
|
- except json.JSONDecodeError:
|
|
|
- LOGGER.error(f"otherFeatures JSON 解析失败: {check_other_features}")
|
|
|
- return response.json(500, "json无效")
|
|
|
- else:
|
|
|
- other_features = {field: -1 for field in other_features_fields}
|
|
|
- LOGGER.info(f'未传入otherFeatures,创建默认值字典: {other_features}')
|
|
|
|
|
|
if not all([device_ver_id, video_code, device_type, supports_alarm, screen_channels, network_type]):
|
|
|
return response.json(444)
|
|
|
try:
|
|
|
now_time = int(time.time())
|
|
|
ai_type = int(ai_type)
|
|
|
+ if other_features:
|
|
|
+ other_features = json.loads(other_features)
|
|
|
+ else:
|
|
|
+ other_features = None
|
|
|
+
|
|
|
device_version_info_qs = DeviceVersionInfo.objects.filter(id=device_ver_id).values('d_code', 'software_ver')
|
|
|
if not device_version_info_qs.exists():
|
|
|
return response.json(173)
|