浏览代码

优化apn_config返回值

linhaohong 7 月之前
父节点
当前提交
ab1b3e0e83
共有 1 个文件被更改,包括 5 次插入10 次删除
  1. 5 10
      Controller/UserDevice/APNConfigController.py

+ 5 - 10
Controller/UserDevice/APNConfigController.py

@@ -1,5 +1,6 @@
 import json
 
+from django.db.models import F
 from django.http import QueryDict
 from django.views import View
 from Ansjer.config import LOGGER
@@ -47,9 +48,10 @@ class APNConfigView(View):
             return response.json(444)
 
         # 查询数据库,获取与国家代码匹配的 APN 配置信息
-        country_apn_qs = CountryAPN.objects.filter(iso=country_code).values(
-            'apn_name', 'apn_address', 'username', 'password', 'auth_type'
-        )
+        country_apn_qs = CountryAPN.objects.filter(iso=country_code).values('username', 'password',
+                                                                            apnName=F('apn_name'),
+                                                                            apnAddress=F('apn_address'),
+                                                                            authType=F('auth_type'))
 
         return response.json(0, list(country_apn_qs))
 
@@ -74,10 +76,3 @@ class APNConfigView(View):
         } for country in countries]
 
         return response.json(0, country_iso_list)
-
-
-
-
-
-
-