|
@@ -17,9 +17,8 @@ from django.forms.models import model_to_dict
|
|
|
from django.utils import timezone
|
|
|
from django.views.generic.base import View
|
|
|
|
|
|
-from Ansjer.cn_config.config_test import CONFIG_INFO
|
|
|
from Ansjer.config import LOGGER, SERIAL_DOMAIN_NAME, HUAWEICLOUD_AK, HUAWEICLOUD_SK, HUAWEICLOUD_OBS_SERVER, \
|
|
|
- HUAWEICLOUD_BAIDU_BIG_MODEL_LICENSE_BUKET, CONFIG_TEST, CONFIG_CN, CONFIG_US, CONFIG_EUR
|
|
|
+ HUAWEICLOUD_BAIDU_BIG_MODEL_LICENSE_BUKET,CONFIG_INFO, CONFIG_TEST, CONFIG_CN, CONFIG_US, CONFIG_EUR
|
|
|
from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, \
|
|
|
AWS_SES_ACCESS_REGION
|
|
|
from Ansjer.config import SERVER_DOMAIN_TEST, SERVER_DOMAIN_CN, SERVER_DOMAIN_US, SERVER_DOMAIN_EUR
|
|
@@ -1751,7 +1750,9 @@ class DeviceManagement(View):
|
|
|
|
|
|
# 获取第一条匹配的记录(通常应该只有一条)
|
|
|
version_config = version_config_qs.first()
|
|
|
-
|
|
|
+ other_features = ''
|
|
|
+ if version_config.other_features:
|
|
|
+ other_features = json.loads(version_config.other_features)
|
|
|
# 将数据库字段映射为驼峰命名的响应数据
|
|
|
req_data = {
|
|
|
'dCode': version_config.d_code,
|
|
@@ -1759,15 +1760,17 @@ class DeviceManagement(View):
|
|
|
'firmwareVer': version_config.firmware_ver,
|
|
|
'videoCode': version_config.video_code,
|
|
|
'regionAlexa': version_config.region_alexa,
|
|
|
- 'supportsHumanTracking': version_config.supports_human_tracking,
|
|
|
- 'supportsCustomVoice': version_config.supports_custom_voice,
|
|
|
- 'supportsDualBandWifi': version_config.supports_dual_band_wifi,
|
|
|
- 'supportsFourPoint': version_config.supports_four_point,
|
|
|
- 'supports4g': version_config.supports_4g,
|
|
|
- 'supportsPTZ': version_config.supports_ptz,
|
|
|
- 'supportsAi': version_config.supports_ai,
|
|
|
- 'supportsCloudStorage': version_config.supports_cloud_storage,
|
|
|
- 'supportsAlexa': version_config.supports_alexa,
|
|
|
+ # 布尔字段转换为int
|
|
|
+ 'supportsHumanTracking': int(version_config.supports_human_tracking),
|
|
|
+ 'supportsCustomVoice': int(version_config.supports_custom_voice),
|
|
|
+ 'supportsDualBandWifi': int(version_config.supports_dual_band_wifi),
|
|
|
+ 'supportsFourPoint': int(version_config.supports_four_point),
|
|
|
+ 'supports4g': int(version_config.supports_4g),
|
|
|
+ 'supportsPTZ': int(version_config.supports_ptz),
|
|
|
+ 'supportsAi': int(version_config.supports_ai),
|
|
|
+ 'supportsCloudStorage': int(version_config.supports_cloud_storage),
|
|
|
+ 'supportsAlexa': int(version_config.supports_alexa),
|
|
|
+ # 其他非布尔字段保持不变
|
|
|
'deviceType': version_config.device_type,
|
|
|
'resolution': version_config.resolution,
|
|
|
'aiType': version_config.ai_type,
|
|
@@ -1775,7 +1778,7 @@ class DeviceManagement(View):
|
|
|
'supportsNightVision': version_config.supports_night_vision,
|
|
|
'screenChannels': version_config.screen_channels,
|
|
|
'networkType': version_config.network_type,
|
|
|
- 'otherFeatures': version_config.other_features,
|
|
|
+ 'otherFeatures': other_features,
|
|
|
'electricityStatistics': version_config.electricity_statistics,
|
|
|
'supportsPetTracking': version_config.supports_pet_tracking
|
|
|
}
|
|
@@ -1824,11 +1827,9 @@ class DeviceManagement(View):
|
|
|
for server_url in target_servers:
|
|
|
try:
|
|
|
# 发送请求并设置超时(10秒)
|
|
|
- headers = {'Content-Type': 'application/json'}
|
|
|
resp = requests.post(
|
|
|
- server_url,
|
|
|
- json=req_data,
|
|
|
- headers=headers,
|
|
|
+ url=server_url,
|
|
|
+ data=req_data,
|
|
|
timeout=10 # 超时时间
|
|
|
)
|
|
|
resp.raise_for_status() # 抛出HTTP错误(如400/500)
|