chenshibin 4 år sedan
förälder
incheckning
50292d7e3a
2 ändrade filer med 42 tillägg och 40 borttagningar
  1. 15 14
      Controller/EquipmentManager.py
  2. 27 26
      Controller/EquipmentManagerV3.py

+ 15 - 14
Controller/EquipmentManager.py

@@ -388,9 +388,19 @@ def addInterface(request):
 
                 pk = CommonService.getUserID(getUser=False)
 
+
+
+                userName = Device_User.objects.get(userID=userID).username
+                main_exist = Device_Info.objects.filter(UID=UID)
+                main_exist = main_exist.filter(~Q(vodPrimaryUserID='')).values('vodPrimaryUserID', 'vodPrimaryMaster')
+                vodPrimaryUserID = userID
+                vodPrimaryMaster = userName
+                if main_exist.exists():
+                    vodPrimaryUserID = main_exist[0]['vodPrimaryUserID']
+                    vodPrimaryMaster = main_exist[0]['vodPrimaryMaster']
+
                 is_bind = Device_Info.objects.filter(UID=UID, isShare=False).values('userID__userID')
                 # 判断是否有已绑定用户
-                # 判断是否有已绑定用户
                 if is_bind and isCheckMainUser == '1':
                     res = {
                         'id': pk,
@@ -404,27 +414,18 @@ def addInterface(request):
                         'isShare': '',
                         'primaryUserID': '',
                         'primaryMaster': '',
-                        'vodPrimaryUserID': '',
-                        'vodPrimaryMaster': '',
+                        'vodPrimaryUserID': vodPrimaryUserID,
+                        'vodPrimaryMaster': vodPrimaryMaster,
                         'data_joined': '',
                         'version': '',
                         'isVod': '',
-                        'isExist': ''
+                        'isExist': '',
+                        'userID__userEmail': ''
                     }
                     res['vod'] = {}
                     res['isMainUserExists'] = 1
                     return response.json(0, res)
 
-                userName = Device_User.objects.get(userID=userID).username
-                main_exist = Device_Info.objects.filter(UID=UID)
-                main_exist = main_exist.filter(~Q(vodPrimaryUserID='')).values('vodPrimaryUserID', 'vodPrimaryMaster')
-                vodPrimaryUserID = userID
-                vodPrimaryMaster = userName
-                if main_exist.exists():
-                    vodPrimaryUserID = main_exist[0]['vodPrimaryUserID']
-                    vodPrimaryMaster = main_exist[0]['vodPrimaryMaster']
-
-
                 try:
                     # 判断是否有用户绑定
                     nowTime = int(time.time())

+ 27 - 26
Controller/EquipmentManagerV3.py

@@ -91,31 +91,7 @@ class EquipmentManagerV3(View):
 
                     pk = CommonService.getUserID(getUser=False)
 
-                    is_bind = Device_Info.objects.filter(UID=UID, isShare=False).values('userID__userID')
-                    # 判断是否有已绑定用户
-                    if is_bind and isCheckMainUser == '1':
-                        res = {
-                            'id' : pk,
-                            'userID' : userID,
-                            'NickName' : NickName,
-                            'UID' : UID,
-                            'View_Account' : View_Account,
-                            'View_Password' : View_Password,
-                            'ChannelIndex' : ChannelIndex,
-                            'Type' : Type,
-                            'isShare' : '',
-                            'primaryUserID' : '',
-                            'primaryMaster' : '',
-                            'vodPrimaryUserID' : '',
-                            'vodPrimaryMaster' : '',
-                            'data_joined' : '',
-                            'version' : '',
-                            'isVod' : '',
-                            'isExist' : ''
-                        }
-                        res['vod'] = {}
-                        res['isMainUserExists'] = 1
-                        return response.json(0, res)
+
 
 
                     userName = Device_User.objects.get(userID=userID).username
@@ -127,7 +103,32 @@ class EquipmentManagerV3(View):
                         vodPrimaryUserID = main_exist[0]['vodPrimaryUserID']
                         vodPrimaryMaster = main_exist[0]['vodPrimaryMaster']
 
-
+                    is_bind = Device_Info.objects.filter(UID=UID, isShare=False).values('userID__userID')
+                    # 判断是否有已绑定用户
+                    if is_bind and isCheckMainUser == '1':
+                        res = {
+                            'id': pk,
+                            'userID': userID,
+                            'NickName': NickName,
+                            'UID': UID,
+                            'View_Account': View_Account,
+                            'View_Password': View_Password,
+                            'ChannelIndex': ChannelIndex,
+                            'Type': Type,
+                            'isShare': '',
+                            'primaryUserID': '',
+                            'primaryMaster': '',
+                            'vodPrimaryUserID': vodPrimaryUserID,
+                            'vodPrimaryMaster': vodPrimaryMaster,
+                            'data_joined': '',
+                            'version': '',
+                            'isVod': '',
+                            'isExist': '',
+                            'userID__userEmail' : ''
+                        }
+                        res['vod'] = {}
+                        res['isMainUserExists'] = 1
+                        return response.json(0, res)
 
                     try:
                         # 判断是否有用户绑定