|
@@ -326,10 +326,12 @@ class FeedBackView(View):
|
|
|
region_name = AWS_IOT_SES_ACCESS_CHINA_REGION
|
|
|
aws_access_key_id = AWS_ACCESS_KEY_ID[0]
|
|
|
secret_access_key = AWS_SECRET_ACCESS_KEY[0]
|
|
|
+ source_bucket = 'push'
|
|
|
else: # 国外
|
|
|
region_name = AWS_SES_ACCESS_REGION
|
|
|
aws_access_key_id = AWS_ACCESS_KEY_ID[1]
|
|
|
secret_access_key = AWS_SECRET_ACCESS_KEY[1]
|
|
|
+ source_bucket = 'foreignpush'
|
|
|
equipment_info_id = equipment_info_id[1:]
|
|
|
now_time = int(time.time())
|
|
|
is_st = int(is_st)
|
|
@@ -343,14 +345,22 @@ class FeedBackView(View):
|
|
|
file_path = '{uid}/{channel}/{event_time}.jpeg'.format(uid=uid,
|
|
|
channel=channel,
|
|
|
event_time=event_time)
|
|
|
- s3.copy_obj('push', 'push-inaccurate', file_path)
|
|
|
+ try:
|
|
|
+ s3.copy_obj(source_bucket, 'push-inaccurate', file_path)
|
|
|
+ except Exception as e:
|
|
|
+ if e.response['Error']['Code'] == "404":
|
|
|
+ return response.json(173)
|
|
|
else:
|
|
|
for index in range(3):
|
|
|
file_path = '{uid}/{channel}/{event_time}_{index}.jpeg'.format(uid=uid,
|
|
|
channel=channel,
|
|
|
event_time=event_time,
|
|
|
index=index)
|
|
|
- s3.copy_obj('push', 'push-inaccurate', file_path)
|
|
|
+ try:
|
|
|
+ s3.copy_obj(source_bucket, 'push-inaccurate', file_path)
|
|
|
+ except Exception as e:
|
|
|
+ if e.response['Error']['Code'] == "404":
|
|
|
+ continue
|
|
|
PushInaccurateFeedback.objects.create(equipment_info_id=equipment_info_id,
|
|
|
user_id=user_id, event_type=event_type,
|
|
|
uid=uid, channel=channel, add_time=now_time,
|