|
@@ -605,6 +605,10 @@ class DetectControllerViewV2(View):
|
|
|
|
|
|
# 国内生产环境默认不实例OCI对象
|
|
|
oci = self.get_oci_client()
|
|
|
+ # 华为云
|
|
|
+ obs_client = ObsClient(
|
|
|
+ access_key_id=HUAWEICLOUD_AK, secret_access_key=HUAWEICLOUD_SK, server=HUAWEICLOUD_OBS_SERVER)
|
|
|
+
|
|
|
uid = params['uid']
|
|
|
is_st = params['is_st']
|
|
|
storage_location = params['storage_location']
|
|
@@ -622,6 +626,10 @@ class DetectControllerViewV2(View):
|
|
|
thumbspng = '{}/{}/{}.jpeg'.format(uid, channel, event_time)
|
|
|
if storage_location == 1: # 阿里云oss
|
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
|
+ elif storage_location == 5: # 华为云
|
|
|
+ create_res = obs_client.createSignedUrl(
|
|
|
+ method='GET', bucketName=HUAWEICLOUD_PUSH_BUKET, objectKey=thumbspng, expires=300)
|
|
|
+ img_url = create_res.signedUrl
|
|
|
elif storage_location in [3, 4]:
|
|
|
prefix_name = f'{uid}/'
|
|
|
img_url = DetectControllerViewV2.oci_object_url(oci, redis_obj, uid, prefix_name)
|
|
@@ -645,6 +653,10 @@ class DetectControllerViewV2(View):
|
|
|
thumbspng = '{}/{}/{}_{}.jpeg'.format(uid, channel, event_time, i)
|
|
|
if storage_location == 1: # 阿里云oss
|
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
|
+ elif storage_location == 5: # 华为云
|
|
|
+ create_res = obs_client.createSignedUrl(
|
|
|
+ method='GET', bucketName=HUAWEICLOUD_PUSH_BUKET, objectKey=thumbspng, expires=300)
|
|
|
+ img_url = create_res.signedUrl
|
|
|
elif storage_location in [3, 4]:
|
|
|
prefix_name = f'{uid}/'
|
|
|
img_url = DetectControllerViewV2.oci_object_url(oci, redis_obj, uid, prefix_name)
|
|
@@ -724,6 +736,9 @@ class DetectControllerViewV2(View):
|
|
|
|
|
|
# 国内生产环境默认不实例OCI对象
|
|
|
oci = self.get_oci_client()
|
|
|
+ # 华为云
|
|
|
+ obs_client = ObsClient(
|
|
|
+ access_key_id=HUAWEICLOUD_AK, secret_access_key=HUAWEICLOUD_SK, server=HUAWEICLOUD_OBS_SERVER)
|
|
|
redis_obj = RedisObject(3)
|
|
|
|
|
|
if msg_data:
|
|
@@ -765,6 +780,10 @@ class DetectControllerViewV2(View):
|
|
|
thumbspng = '{}/{}/{}.jpeg'.format(uid, channel, event_time)
|
|
|
if storage_location == 1: # 阿里云oss
|
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
|
+ elif storage_location == 5: # 华为云
|
|
|
+ create_res = obs_client.createSignedUrl(
|
|
|
+ method='GET', bucketName=HUAWEICLOUD_PUSH_BUKET, objectKey=thumbspng, expires=300)
|
|
|
+ img_url = create_res.signedUrl
|
|
|
elif storage_location in [3, 4]:
|
|
|
prefix_name = f'{uid}/'
|
|
|
img_url = DetectControllerViewV2.oci_object_url(oci, redis_obj, uid, prefix_name)
|
|
@@ -825,6 +844,10 @@ class DetectControllerViewV2(View):
|
|
|
thumbspng = '{}/{}/{}_{}.jpeg'.format(uid, channel, event_time, i)
|
|
|
if storage_location == 1: # 阿里云oss
|
|
|
img_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
|
+ elif storage_location == 5: # 华为云
|
|
|
+ create_res = obs_client.createSignedUrl(
|
|
|
+ method='GET', bucketName=HUAWEICLOUD_PUSH_BUKET, objectKey=thumbspng, expires=300)
|
|
|
+ img_url = create_res.signedUrl
|
|
|
elif storage_location in [3, 4]:
|
|
|
prefix_name = f'{uid}/'
|
|
|
img_url = DetectControllerViewV2.oci_object_url(oci, redis_obj, uid, prefix_name)
|