Эх сурвалжийг харах

优化AI数据显示&联通4G不显示云存

zhangdongming 2 жил өмнө
parent
commit
d9a478ff59

+ 14 - 0
AdminController/AiServeController.py

@@ -421,6 +421,7 @@ class AiServeView(View):
                 if country_qs.exists():
                     country = country_qs.first()['country_name']
                 data_dict['country'] = country
+                data_dict['deviceCountry'] = self.get_device_country(data_dict['ip'])
                 uid_set_qs = UidSetModel.objects.filter(uid=order['UID']).values('version')
                 data_dict['version'] = uid_set_qs.first()['version'] if uid_set_qs.exists() else ''
                 ai_service_qs = AiService.objects.filter(
@@ -436,6 +437,19 @@ class AiServeView(View):
             print(e)
             return response.json(500, repr(e))
 
+    @staticmethod
+    def get_device_country(ip):
+        """
+        根据IP获取国家名称
+        """
+        if not ip:
+            return '未知国家'
+        ipInfo = CommonService.getIpIpInfo(ip, 'EN')
+        country_qs = CountryModel.objects.filter(country_code=ipInfo['country_code']).values('id', 'country_name')
+        if not country_qs.exists():
+            return '未知国家'
+        return country_qs[0]['country_name']
+
     def getAiDataList(self, request_dict, response):
         year = request_dict.get('year', None)
         Jan = int(time.mktime(time.strptime(year + '-1-1 00:00:00', "%Y-%m-%d %H:%M:%S")))

+ 1 - 0
Controller/EquipmentManagerV3.py

@@ -790,6 +790,7 @@ class EquipmentManagerV3(View):
                 p['channels'] = uv_dict[p_uid]['channels']
                 p['double_wifi'] = uv_dict[p_uid]['double_wifi']
                 p['mobile4G'] = uv_dict[p_uid]['mobile4G']
+                p['isCameraOpenCloud'] = 0 if uv_dict[p_uid]['mobile4G'] == 1 else p['isCameraOpenCloud']
                 p['is_ai'] = uv_dict[p_uid]['is_ai']
                 p['ai_type'] = uv_dict[p_uid]['ai_type']
                 p['isSupportFourPoint'] = uv_dict[p_uid]['isSupportFourPoint']