瀏覽代碼

代码修改

zhangdongming 2 年之前
父節點
當前提交
8f835eaf7a
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3 4
      AdminController/AiServeController.py

+ 3 - 4
AdminController/AiServeController.py

@@ -445,11 +445,10 @@ class AiServeView(View):
         if not ip:
             return '未知国家'
         ipInfo = CommonService.getIpIpInfo(ip, 'EN')
-        country_qs = CountryModel.objects.filter(country_code=ipInfo['country_code']).values('id')
+        country_qs = CountryModel.objects.filter(country_code=ipInfo['country_code']).values('id', 'country_name')
         if not country_qs.exists():
-            return country_qs[0]['country_name']
-        return '未知国家'
-
+            return '未知国家'
+        return country_qs[0]['country_name']
 
     def getAiDataList(self, request_dict, response):
         year = request_dict.get('year', None)