|
@@ -77,7 +77,7 @@ class EquipmentManagerV3(View):
|
|
|
ChannelIndex = request_dict.get('ChannelIndex', None)
|
|
|
version = request_dict.get('version', '')
|
|
|
isCheckMainUser = request_dict.get('isCheckMainUser', None)
|
|
|
- isMainUserExists = False
|
|
|
+
|
|
|
if not all([UID, NickName, View_Account, Type, ChannelIndex]): # Type和ChannelIndex可能为0
|
|
|
return response.json(444, {'param': 'UID, NickName, View_Account, Type, ChannelIndex'})
|
|
|
|
|
@@ -100,29 +100,27 @@ class EquipmentManagerV3(View):
|
|
|
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
|
|
|
+
|
|
|
+ vodPrimaryUserID = ''
|
|
|
vodPrimaryMaster = userName
|
|
|
+ primaryUserID = ''
|
|
|
+ primaryMaster = ''
|
|
|
+ isShare = False
|
|
|
+
|
|
|
+ is_bind = Device_Info.objects.filter(UID=UID, isShare=False).values('userID__userID', 'primaryUserID', 'primaryMaster')
|
|
|
+
|
|
|
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', 'vodPrimaryUserID')
|
|
|
- isvodPrimaryUserID = ''
|
|
|
-
|
|
|
- for forbind in is_bind:
|
|
|
- if forbind['vodPrimaryUserID'] != '':
|
|
|
- isvodPrimaryUserID = forbind['vodPrimaryUserID']
|
|
|
+ if is_bind.exists():
|
|
|
+ primaryUserID = is_bind[0]['primaryUserID']
|
|
|
+ primaryMaster = is_bind[0]['primaryMaster']
|
|
|
+ isShare = True
|
|
|
|
|
|
- if isCheckMainUser != '1' :
|
|
|
- if main_exist.exists():
|
|
|
- vodPrimaryUserID = main_exist[0]['vodPrimaryUserID']
|
|
|
- vodPrimaryMaster = main_exist[0]['vodPrimaryMaster']
|
|
|
- else:
|
|
|
- vodPrimaryUserID = ''
|
|
|
- vodPrimaryMaster = ''
|
|
|
|
|
|
isusermain = False
|
|
|
- if is_bind and isvodPrimaryUserID != userID and isvodPrimaryUserID != '':
|
|
|
+ if (vodPrimaryUserID != userID and vodPrimaryUserID != '') or (primaryUserID != userID and primaryUserID != ''):
|
|
|
isusermain = True
|
|
|
|
|
|
# 判断是否有已绑定用户
|
|
@@ -136,9 +134,9 @@ class EquipmentManagerV3(View):
|
|
|
'View_Password': View_Password,
|
|
|
'ChannelIndex': ChannelIndex,
|
|
|
'Type': Type,
|
|
|
- 'isShare': False,
|
|
|
- 'primaryUserID': '',
|
|
|
- 'primaryMaster': '',
|
|
|
+ 'isShare': isShare,
|
|
|
+ 'primaryUserID': primaryUserID,
|
|
|
+ 'primaryMaster': primaryMaster,
|
|
|
'vodPrimaryUserID': vodPrimaryUserID,
|
|
|
'vodPrimaryMaster': vodPrimaryMaster,
|
|
|
'data_joined': '',
|