Bläddra i källkod

更新成test分支代码

locky 3 år sedan
förälder
incheckning
09469080cb
3 ändrade filer med 22 tillägg och 13 borttagningar
  1. 4 0
      .gitignore
  2. 1 1
      Ansjer/urls.py
  3. 17 12
      Controller/EquipmentManagerV3.py

+ 4 - 0
.gitignore

@@ -15,4 +15,8 @@
 /sdk_install
 /DB/mydata4vipday2.ipdb
 /venv
+/local_manage.py
+/Controller/TestApi.py
 
+/PushModel/
+/SerialModel/

+ 1 - 1
Ansjer/urls.py

@@ -293,7 +293,7 @@ urlpatterns = [
     re_path('user/(?P<operation>.*)', UIDManageUserController.UserView.as_view()),
     re_path('uid/(?P<operation>.*)', UIDController.UIDView.as_view()),
     re_path('history/(?P<operation>.*)', HistoryUIDController.HistoryUIDView.as_view()),
-    re_path('log/(?P<operation>.*)', LogController.LogView.as_view()),
+    re_path('^log/(?P<operation>.*)', LogController.LogView.as_view()),
     re_path('orderTask/(?P<operation>.*)', OrderTaskController.OrderTaskView.as_view()),
     path('upload', FileController.UploadUIDFileView.as_view()),
     path('download', FileController.DownloadUIDFileView.as_view()),

+ 17 - 12
Controller/EquipmentManagerV3.py

@@ -255,7 +255,6 @@ class EquipmentManagerV3(View):
                         'endpoint': iotqs[0].endpoint,
                         'token_iot_number': iotqs[0].endpoint
                 }
-
             return response.json(0, res)
 
 
@@ -274,7 +273,6 @@ class EquipmentManagerV3(View):
             return response.json(309)
 
         try:
-            # deviceData = json.loads(deviceContent)
             deviceData = eval(deviceContent)
             if deviceData.__contains__('userID_id'):
                 asy = threading.Thread(target=ModelService.update_log,
@@ -319,6 +317,7 @@ class EquipmentManagerV3(View):
                     UidSetModel.objects.create(**uid_set_create_dict)
                 di_qs = Device_Info.objects.filter(UID=uid)
                 di_qs.update(NickName=nickname)
+
                 if deviceData is not None and deviceData.__contains__('NickName') and us_qs[0].is_alexa == 1:
                     # 请求Alexa服务器更新事件网关
                     url = 'https://www.zositech.xyz/deviceStatus/addOrUpdateV2'
@@ -327,6 +326,7 @@ class EquipmentManagerV3(View):
                     data_list = json.dumps(data_list)
                     data = {'data_list': data_list}
                     requests.post(url, data=data, timeout=2)
+
             return response.json(0, res)
 
     # 编辑通道名
@@ -395,7 +395,7 @@ class EquipmentManagerV3(View):
                                                                     'TimeZone', 'TimeStatus', 'SpaceUsable',
                                                                     'SpaceSum', 'MirrorType', 'RecordType',
                                                                     'OutdoorModel', 'WIFIName', 'isDetector',
-                                                                    'DetectorRank', 'is_human', 'is_custom_voice', 'double_wifi')
+                                                                    'DetectorRank', 'is_human', 'is_custom_voice', 'is_ptz', 'double_wifi')
         uv_dict = {}
         for us in us_qs:
             uv_dict[us['uid']] = {
@@ -420,6 +420,7 @@ class EquipmentManagerV3(View):
                 'DetectorRank': us['DetectorRank'],
                 'is_human': us['is_human'],
                 'is_custom_voice': us['is_custom_voice'],
+                'is_ptz': us['is_ptz'],
                 'double_wifi': us['double_wifi']
             }
             # 从uid_channel里面取出通道配置信息
@@ -481,16 +482,19 @@ class EquipmentManagerV3(View):
 
             p_uid = p['UID']
 
-            # # 返回设备初始化字符
-            # uid_qs = UIDModel.objects.filter(uid=p_uid).values('platform', 'init_string', 'init_string_app')
-            # if uid_qs.exists():
-            #     p['platform'] = uid_qs[0]['platform']
-            #     p['initString'] = uid_qs[0]['init_string']
-            #     p['initStringApp'] = uid_qs[0]['init_string_app']
+            # 返回设备初始化字符
+            uid_qs = UIDModel.objects.filter(uid=p_uid).values('platform', 'init_string', 'init_string_app')
+            if uid_qs.exists():
+                p['platform'] = uid_qs[0]['platform']
+                p['initString'] = uid_qs[0]['init_string']
+                p['initStringApp'] = uid_qs[0]['init_string_app']
 
             if p_uid in uv_dict:
                 # 设备版本号
-                p['uid_version'] = uv_dict[p_uid]['version']
+                uidversion = uv_dict[p_uid]['version']
+                if len(uidversion) >6:
+                    uidversion = uidversion[0 : uidversion.rfind('.')]
+                p['uid_version'] = uidversion
                 p['ucode'] = uv_dict[p_uid]['ucode']
                 p['detect_interval'] = uv_dict[p_uid]['detect_interval']
                 p['detect_status'] = uv_dict[p_uid]['detect_status']
@@ -510,6 +514,7 @@ class EquipmentManagerV3(View):
                 p['DetectorRank'] = uv_dict[p_uid]['DetectorRank']
                 p['is_human'] = uv_dict[p_uid]['is_human']
                 p['is_custom_voice'] = uv_dict[p_uid]['is_custom_voice']
+                p['is_ptz'] = uv_dict[p_uid]['is_ptz']
                 p['channels'] = uv_dict[p_uid]['channels']
                 p['double_wifi'] = uv_dict[p_uid]['double_wifi']
                 # 设备昵称 调用影子信息昵称,先阶段不可
@@ -565,12 +570,12 @@ class EquipmentManagerV3(View):
             if device_qs.exists():
                 if fuzzy:
                     device_qs = device_qs.filter(Q(UID__icontains=fuzzy) | Q(NickName__icontains=fuzzy))
-
                 device_qs = device_qs.values('id', 'userID', 'NickName', 'UID', 'View_Account',
                                              'View_Password', 'ChannelIndex', 'Type', 'isShare',
                                              'primaryUserID', 'primaryMaster', 'data_joined', 'vodPrimaryUserID',
                                              'vodPrimaryMaster', 'userID__userEmail',
-                                             'version', 'isVod', 'isExist', 'NotificationMode', 'isCameraOpenCloud', 'serial_number')
+                                             'version', 'isVod', 'isExist', 'NotificationMode', 'isCameraOpenCloud',
+                                             'serial_number')
 
                 dvls = CommonService.qs_to_list(device_qs)
                 uid_list = []