|
@@ -285,14 +285,30 @@ class RegionView(View):
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def get_country_and_domain_name(request_dict, response):
|
|
def get_country_and_domain_name(request_dict, response):
|
|
|
|
+ """
|
|
|
|
+ 获取国家和域名
|
|
|
|
+ @param request_dict: 请求数据
|
|
|
|
+ @request_dict lang: 语言
|
|
|
|
+ @request_dict app_bundle_id: app包id
|
|
|
|
+ @request_dict time_stamp: 时间戳
|
|
|
|
+ @request_dict time_stamp_token: 时间戳token
|
|
|
|
+ @param response: 响应
|
|
|
|
+ @return: response
|
|
|
|
+ """
|
|
lang = request_dict.get('lang', None)
|
|
lang = request_dict.get('lang', None)
|
|
- app_bundle_id = request_dict.get('app_bundle_id', 'com.ansjer.zccloud') # AVSS不传app_bundle_id参数
|
|
|
|
|
|
+ app_bundle_id = request_dict.get('app_bundle_id', None)
|
|
time_stamp = request_dict.get('time_stamp', None)
|
|
time_stamp = request_dict.get('time_stamp', None)
|
|
time_stamp_token = request_dict.get('time_stamp_token', None)
|
|
time_stamp_token = request_dict.get('time_stamp_token', None)
|
|
|
|
|
|
if not all([lang, app_bundle_id, time_stamp, time_stamp_token]):
|
|
if not all([lang, app_bundle_id, time_stamp, time_stamp_token]):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
|
|
|
|
|
|
+ # AVSS不传app_bundle_id
|
|
|
|
+ is_app = True
|
|
|
|
+ if app_bundle_id is None:
|
|
|
|
+ app_bundle_id = 'com.ansjer.zccloud'
|
|
|
|
+ is_app = False
|
|
|
|
+
|
|
try:
|
|
try:
|
|
# 校验时间戳token
|
|
# 校验时间戳token
|
|
time_stamp_token = int(CommonService.decode_data(time_stamp_token))
|
|
time_stamp_token = int(CommonService.decode_data(time_stamp_token))
|
|
@@ -323,6 +339,15 @@ class RegionView(View):
|
|
else:
|
|
else:
|
|
country_qs = country_qs.annotate(api=F('country__region__api'))
|
|
country_qs = country_qs.annotate(api=F('country__region__api'))
|
|
country_qs = country_qs.values('country_id', 'country_name', 'api', 'push_api').order_by('country_id')
|
|
country_qs = country_qs.values('country_id', 'country_name', 'api', 'push_api').order_by('country_id')
|
|
|
|
+
|
|
|
|
+ # app中国返回美洲域名
|
|
|
|
+ if is_app:
|
|
|
|
+ for country in country_qs:
|
|
|
|
+ if country['country_id'] == 1:
|
|
|
|
+ country['api'] = 'https://www.dvema.com/'
|
|
|
|
+ country['push_api'] = 'https://push.dvema.com/'
|
|
|
|
+ break
|
|
|
|
+
|
|
return response.json(0, list(country_qs))
|
|
return response.json(0, list(country_qs))
|
|
except Exception as e:
|
|
except Exception as e:
|
|
return response.json(500, repr(e))
|
|
return response.json(500, repr(e))
|