|
@@ -39,24 +39,19 @@ class APNConfigView(View):
|
|
|
|
|
|
@staticmethod
|
|
|
def get_apn_config(request_dict, response):
|
|
|
- # 从请求字典中获取uid和version
|
|
|
- country_code = request_dict.get('countryCode', None)
|
|
|
+ # 从请求字典中获取国家代码
|
|
|
+ country_code = request_dict.get('countryCode')
|
|
|
+
|
|
|
+ # 检查 country_code 是否存在,如果不存在,返回错误代码444
|
|
|
if not country_code:
|
|
|
return response.json(444)
|
|
|
- country_code = country_code.upper()
|
|
|
- country_apn_qs = CountryAPN.objects.filter(iso=country_code).values('apn_name', 'apn_address', 'username', 'password',
|
|
|
- 'auth_type')
|
|
|
- country_apn_list = []
|
|
|
- for country_apn in country_apn_qs:
|
|
|
- country_apn_list.append({
|
|
|
- 'apnName': country_apn['apn_name'] if country_apn['apn_name'] else '',
|
|
|
- 'apnAddress': country_apn['apn_address'] if country_apn['apn_address'] else '',
|
|
|
- 'username': country_apn['username'] if country_apn['username'] else '',
|
|
|
- 'password': country_apn['password'] if country_apn['password'] else '',
|
|
|
- 'authType': country_apn['auth_type'] if country_apn['auth_type'] else '',
|
|
|
- })
|
|
|
-
|
|
|
- return response.json(0, country_apn_list)
|
|
|
+
|
|
|
+ # 查询数据库,获取与国家代码匹配的 APN 配置信息
|
|
|
+ country_apn_qs = CountryAPN.objects.filter(iso=country_code).values(
|
|
|
+ 'apn_name', 'apn_address', 'username', 'password', 'auth_type'
|
|
|
+ )
|
|
|
+
|
|
|
+ return response.json(0, list(country_apn_qs))
|
|
|
|
|
|
@staticmethod
|
|
|
def get_country_code_list(request_dict, response):
|