locky 2 дней назад
Родитель
Сommit
e4e8f95b0a
2 измененных файлов с 12 добавлено и 6 удалено
  1. 11 5
      Controller/EquipmentManagerV3.py
  2. 1 1
      Service/UserDeviceService.py

+ 11 - 5
Controller/EquipmentManagerV3.py

@@ -323,14 +323,20 @@ class EquipmentManagerV3(View):
                             UidChannelSet_bulk.append(UidChannelSet)
                         UidChannelSetModel.objects.bulk_create(UidChannelSet_bulk)
 
-                # 获取当前用户下最大 sort_order
-                max_sort_order = Device_Info.objects.filter(userID_id=userID).aggregate(
-                    Max('sort_order'))['sort_order__max'] or 0
+                # # 获取当前用户下最大 sort_order
+                # max_sort_order = Device_Info.objects.filter(userID_id=userID).aggregate(
+                #     Max('sort_order'))['sort_order__max'] or 0
+                # userDevice = Device_Info(id=id, userID_id=userID, UID=UID, NickName=NickName, View_Account=View_Account,
+                #                          View_Password=View_Password, Type=Type, ChannelIndex=ChannelIndex,
+                #                          version=version,
+                #                          vodPrimaryUserID=vodPrimaryUserID, vodPrimaryMaster=vodPrimaryMaster,
+                #                          sort_order=max_sort_order + 1)
+
                 userDevice = Device_Info(id=id, userID_id=userID, UID=UID, NickName=NickName, View_Account=View_Account,
                                          View_Password=View_Password, Type=Type, ChannelIndex=ChannelIndex,
                                          version=version,
-                                         vodPrimaryUserID=vodPrimaryUserID, vodPrimaryMaster=vodPrimaryMaster,
-                                         sort_order=max_sort_order + 1)
+                                         vodPrimaryUserID=vodPrimaryUserID, vodPrimaryMaster=vodPrimaryMaster)
+                
                 userDevice.save()
                 # 保存用户推送按钮信息
                 button_qs = UserAudioVideoPush.objects.filter(uid=UID)

+ 1 - 1
Service/UserDeviceService.py

@@ -45,7 +45,7 @@ class UserDeviceService:
                              'Type', 'isShare', 'primaryUserID', 'primaryMaster', 'data_joined', 'vodPrimaryUserID',
                              'vodPrimaryMaster', 'userID__userEmail', 'version', 'isVod', 'isExist', 'NotificationMode',
                              'isCameraOpenCloud', 'serial_number', 'device_group_id', 'sort_order').\
-            order_by('-sort_order', '-data_joined')
+            order_by('-data_joined')
         CommonService.qs_to_list(dv_qs)
         exist_uid = []
         unique_results = []