|
@@ -839,12 +839,16 @@ class DevicePushService:
|
|
|
params['Bucket'] = 'push'
|
|
|
else: # 1:国外
|
|
|
params['Bucket'] = 'foreignpush'
|
|
|
- # 区域是国外 并且存储位置OCI
|
|
|
- if kwargs['region'] == 1 and storage_location in [3, 4]:
|
|
|
+ # 根据存储区域返回链接
|
|
|
+ if storage_location in [3, 4]:
|
|
|
# OCI
|
|
|
img_url = DevicePushService.create_oci_req_url(storage_location, params['Bucket'], key_name)
|
|
|
res_data['img_push'] = img_url
|
|
|
res_data['msg'] = 'success 1'
|
|
|
+ elif storage_location == 2:
|
|
|
+ # AWS
|
|
|
+ img_url = DevicePushService.generate_s3_url(kwargs['aws_s3_client'], params)
|
|
|
+ res_data['img_push'] = img_url
|
|
|
else:
|
|
|
# 华为云
|
|
|
img_url = DevicePushService.create_obs_signed_url(key_name, 'PUT')
|
|
@@ -863,15 +867,17 @@ class DevicePushService:
|
|
|
for i in range(kwargs['is_st']):
|
|
|
key_name = '{}/{}/{}_{}.jpeg'.format(kwargs['uid'], kwargs['channel'], kwargs['n_time'], i)
|
|
|
params['Key'] = key_name
|
|
|
- if kwargs['region'] == 1:
|
|
|
+ if storage_location in [3, 4]:
|
|
|
# OCI
|
|
|
- img_url = DevicePushService.create_oci_req_url(storage_location, params['Bucket'], key_name,
|
|
|
- oci_client)
|
|
|
- img_url_list.append(img_url)
|
|
|
+ img_url = DevicePushService.create_oci_req_url(
|
|
|
+ storage_location, params['Bucket'], key_name, oci_client)
|
|
|
+ elif storage_location == 2:
|
|
|
+ # AWS
|
|
|
+ img_url = DevicePushService.generate_s3_url(kwargs['aws_s3_client'], params)
|
|
|
else:
|
|
|
# 华为云
|
|
|
img_url = DevicePushService.create_obs_signed_url(key_name, 'PUT')
|
|
|
- img_url_list.append(img_url)
|
|
|
+ img_url_list.append(img_url)
|
|
|
res_data['img_url_list'] = img_url_list
|
|
|
res_data['msg'] = 'success 3'
|
|
|
return res_data
|