|
@@ -42,23 +42,23 @@ class ConfirmRegion(View):
|
|
|
if not device_domain_qs.exists():
|
|
|
DeviceDomainModel.objects.create(ip=ip, country_name=country_code, api=api)
|
|
|
|
|
|
- region = get_push_region(api)
|
|
|
+ push_region = get_push_region(api)
|
|
|
res = {
|
|
|
'request_api_url': api,
|
|
|
'push_api_url': push_api,
|
|
|
- 'region': region
|
|
|
+ 'push_region': push_region
|
|
|
}
|
|
|
return response.json(0, res)
|
|
|
|
|
|
# 不存在则返回美洲域名
|
|
|
- api, push_api, region_id, region = get_default_api()
|
|
|
+ api, push_api, region_id, push_region = get_default_api()
|
|
|
if not device_domain_qs.exists():
|
|
|
DeviceDomainModel.objects.create(ip=ip, country_name='NA', api=api)
|
|
|
|
|
|
res = {
|
|
|
'request_api_url': api,
|
|
|
'push_api_url': push_api,
|
|
|
- 'region': region
|
|
|
+ 'push_region': push_region
|
|
|
}
|
|
|
return response.json(0, res)
|
|
|
except Exception as e:
|
|
@@ -102,15 +102,15 @@ class ConfirmRegionV2(View):
|
|
|
api = country_qs[0]['region__api']
|
|
|
push_api = country_qs[0]['region__push_api']
|
|
|
region_id = country_qs[0]['region__id']
|
|
|
- region = get_push_region(api)
|
|
|
+ push_region = get_push_region(api)
|
|
|
else:
|
|
|
# 返回美洲域名
|
|
|
data_dict['country_code'] = 'NA'
|
|
|
- api, push_api, region_id, region = get_default_api()
|
|
|
+ api, push_api, region_id, push_region = get_default_api()
|
|
|
else:
|
|
|
# 返回美洲域名
|
|
|
data_dict['country_code'] = 'NA'
|
|
|
- api, push_api, region_id, region = get_default_api()
|
|
|
+ api, push_api, region_id, push_region = get_default_api()
|
|
|
|
|
|
# 更新或创建设备域名数据
|
|
|
data_dict['region_id'] = region_id
|
|
@@ -124,7 +124,7 @@ class ConfirmRegionV2(View):
|
|
|
'request_api_url': api,
|
|
|
'push_api_url': push_api,
|
|
|
'region_id': region_id,
|
|
|
- 'region': region
|
|
|
+ 'push_region': push_region
|
|
|
}
|
|
|
return response.json(0, res)
|
|
|
except Exception as e:
|
|
@@ -137,18 +137,18 @@ def get_default_api():
|
|
|
api = region_qs[0]['api']
|
|
|
push_api = region_qs[0]['push_api']
|
|
|
region_id = region_qs[0]['id']
|
|
|
- region = 1 # 推送图片S3存储地区,1:国外, 2:国内
|
|
|
- return api, push_api, region_id, region
|
|
|
+ push_region = 1 # 推送图片S3存储地区,1:国外, 2:国内
|
|
|
+ return api, push_api, region_id, push_region
|
|
|
|
|
|
|
|
|
def get_push_region(api):
|
|
|
"""
|
|
|
根据域名获取推送图片S3存储地区
|
|
|
@param api:
|
|
|
- @return: region
|
|
|
+ @return: push_region
|
|
|
"""
|
|
|
- region = 2 if '.cn' in api else 1
|
|
|
- return region
|
|
|
+ push_region = 2 if '.cn' in api else 1
|
|
|
+ return push_region
|
|
|
|
|
|
|
|
|
class Device_Region(object):
|