|
@@ -11,6 +11,7 @@ from django.views.generic.base import View
|
|
|
|
|
|
from Ansjer.config import DETECT_PUSH_DOMAIN, DETECT_PUSH_DOMAINS, DETECT_PUSH_DOMAIN_JIUAN, DETECT_PUSH_DOMAINS_JIUAN, \
|
|
from Ansjer.config import DETECT_PUSH_DOMAIN, DETECT_PUSH_DOMAINS, DETECT_PUSH_DOMAIN_JIUAN, DETECT_PUSH_DOMAINS_JIUAN, \
|
|
OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, LOGGER, ALGORITHM_COMBO_TYPES
|
|
OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, LOGGER, ALGORITHM_COMBO_TYPES
|
|
|
|
+from Ansjer.config import PUSH_BUCKET
|
|
from Model.models import Device_Info, Equipment_Info, UidSetModel, UidPushModel, CompanyModel, SysMsgModel, \
|
|
from Model.models import Device_Info, Equipment_Info, UidSetModel, UidPushModel, CompanyModel, SysMsgModel, \
|
|
AiService, VodBucketModel
|
|
AiService, VodBucketModel
|
|
from Object.ETkObject import ETkObject
|
|
from Object.ETkObject import ETkObject
|
|
@@ -22,7 +23,6 @@ from Object.utils import LocalDateTimeUtil
|
|
from Service.CommonService import CommonService
|
|
from Service.CommonService import CommonService
|
|
from Service.EquipmentInfoService import EquipmentInfoService
|
|
from Service.EquipmentInfoService import EquipmentInfoService
|
|
from Service.VodHlsService import SplitVodHlsObject
|
|
from Service.VodHlsService import SplitVodHlsObject
|
|
-from Ansjer.config import PUSH_BUCKET
|
|
|
|
|
|
|
|
|
|
|
|
class DetectControllerViewV2(View):
|
|
class DetectControllerViewV2(View):
|
|
@@ -371,7 +371,8 @@ class DetectControllerViewV2(View):
|
|
config=botocore.client.Config(signature_version='s3v4'),
|
|
config=botocore.client.Config(signature_version='s3v4'),
|
|
region_name='cn-northwest-1'
|
|
region_name='cn-northwest-1'
|
|
)
|
|
)
|
|
-
|
|
|
|
|
|
+ oci_eur = OCIObjectStorage('eur')
|
|
|
|
+ oci_us = OCIObjectStorage('us')
|
|
# ai消息标识所有组合标签
|
|
# ai消息标识所有组合标签
|
|
ai_all_event_type = EquipmentInfoService.get_all_comb_event_type()
|
|
ai_all_event_type = EquipmentInfoService.get_all_comb_event_type()
|
|
for equipment_info in equipment_info_qs:
|
|
for equipment_info in equipment_info_qs:
|
|
@@ -388,7 +389,8 @@ class DetectControllerViewV2(View):
|
|
if storage_location == 1: # 阿里云oss
|
|
if storage_location == 1: # 阿里云oss
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
elif storage_location in [3, 4]:
|
|
elif storage_location in [3, 4]:
|
|
- img_url = DetectControllerViewV2.oci_object_url(storage_location, thumbspng)
|
|
|
|
|
|
+ oci = oci_eur if storage_location == 4 else oci_us
|
|
|
|
+ img_url = DetectControllerViewV2.oci_object_url(oci, thumbspng)
|
|
else:
|
|
else:
|
|
params = {'Key': thumbspng}
|
|
params = {'Key': thumbspng}
|
|
if region == 1: # AWS国外
|
|
if region == 1: # AWS国外
|
|
@@ -445,7 +447,8 @@ class DetectControllerViewV2(View):
|
|
if storage_location == 1: # 阿里云oss
|
|
if storage_location == 1: # 阿里云oss
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
elif storage_location in [3, 4]:
|
|
elif storage_location in [3, 4]:
|
|
- img_url = DetectControllerViewV2.oci_object_url(storage_location, thumbspng)
|
|
|
|
|
|
+ oci = oci_eur if storage_location == 4 else oci_us
|
|
|
|
+ img_url = DetectControllerViewV2.oci_object_url(oci, thumbspng)
|
|
else:
|
|
else:
|
|
params = {'Key': thumbspng}
|
|
params = {'Key': thumbspng}
|
|
if region == 1: # 国外AWS
|
|
if region == 1: # 国外AWS
|
|
@@ -478,14 +481,13 @@ class DetectControllerViewV2(View):
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
- def oci_object_url(storage_location, obj_name):
|
|
|
|
|
|
+ def oci_object_url(oci, obj_name):
|
|
"""
|
|
"""
|
|
获取OCI对象存储URL 有效期5分钟
|
|
获取OCI对象存储URL 有效期5分钟
|
|
- @param storage_location: 存储区域
|
|
|
|
|
|
+ @param oci:
|
|
@param obj_name: 对象名称
|
|
@param obj_name: 对象名称
|
|
@return: url
|
|
@return: url
|
|
"""
|
|
"""
|
|
- oci = OCIObjectStorage('eur' if storage_location == 4 else 'us')
|
|
|
|
time_expires = datetime.datetime.utcnow() + datetime.timedelta(minutes=5)
|
|
time_expires = datetime.datetime.utcnow() + datetime.timedelta(minutes=5)
|
|
result = oci.get_preauthenticated_request_url(PUSH_BUCKET, 'ociPush', obj_name, time_expires)
|
|
result = oci.get_preauthenticated_request_url(PUSH_BUCKET, 'ociPush', obj_name, time_expires)
|
|
return result.full_path if result else ''
|
|
return result.full_path if result else ''
|
|
@@ -531,6 +533,8 @@ class DetectControllerViewV2(View):
|
|
region_name='cn-northwest-1'
|
|
region_name='cn-northwest-1'
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+ oci_eur = OCIObjectStorage('eur')
|
|
|
|
+ oci_us = OCIObjectStorage('us')
|
|
# ai消息标识所有组合标签
|
|
# ai消息标识所有组合标签
|
|
ai_all_event_type = EquipmentInfoService.get_all_comb_event_type()
|
|
ai_all_event_type = EquipmentInfoService.get_all_comb_event_type()
|
|
for equipment_info in equipment_info_qs:
|
|
for equipment_info in equipment_info_qs:
|
|
@@ -547,7 +551,8 @@ class DetectControllerViewV2(View):
|
|
if storage_location == 1: # 阿里云oss
|
|
if storage_location == 1: # 阿里云oss
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
elif storage_location in [3, 4]:
|
|
elif storage_location in [3, 4]:
|
|
- img_url = DetectControllerViewV2.oci_object_url(storage_location, thumbspng)
|
|
|
|
|
|
+ oci = oci_eur if storage_location == 4 else oci_us
|
|
|
|
+ img_url = DetectControllerViewV2.oci_object_url(oci, thumbspng)
|
|
else:
|
|
else:
|
|
params = {'Key': thumbspng}
|
|
params = {'Key': thumbspng}
|
|
if region == 1: # AWS国外
|
|
if region == 1: # AWS国外
|
|
@@ -604,7 +609,8 @@ class DetectControllerViewV2(View):
|
|
if storage_location == 1: # 阿里云oss
|
|
if storage_location == 1: # 阿里云oss
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
elif storage_location in [3, 4]:
|
|
elif storage_location in [3, 4]:
|
|
- img_url = DetectControllerViewV2.oci_object_url(storage_location, thumbspng)
|
|
|
|
|
|
+ oci = oci_eur if storage_location == 4 else oci_us
|
|
|
|
+ img_url = DetectControllerViewV2.oci_object_url(oci, thumbspng)
|
|
else:
|
|
else:
|
|
params = {'Key': thumbspng}
|
|
params = {'Key': thumbspng}
|
|
if region == 1: # 国外AWS
|
|
if region == 1: # 国外AWS
|