|
@@ -107,20 +107,23 @@ class DeviceShareView(View):
|
|
|
UID = data.get('UID', None)
|
|
|
sharerDvqs = Device_Info.objects.filter(userID_id=sharer, UID=UID, isShare=False). \
|
|
|
values('NickName', 'Type')
|
|
|
- sharerDuqs = Device_User.objects.filter(userID=sharer).values('username', 'userEmail', 'phone')
|
|
|
- if sharerDuqs[0]['username']:
|
|
|
- share_user = sharerDuqs[0]['username']
|
|
|
- elif sharerDuqs[0]['userEmail']:
|
|
|
- share_user = sharerDuqs[0]['userEmail']
|
|
|
- elif sharerDuqs[0]['phone']:
|
|
|
- share_user = sharerDuqs[0]['phone']
|
|
|
+ if sharerDvqs:
|
|
|
+ sharerDuqs = Device_User.objects.filter(userID=sharer).values('username', 'userEmail', 'phone')
|
|
|
+ if sharerDuqs[0]['username']:
|
|
|
+ share_user = sharerDuqs[0]['username']
|
|
|
+ elif sharerDuqs[0]['userEmail']:
|
|
|
+ share_user = sharerDuqs[0]['userEmail']
|
|
|
+ elif sharerDuqs[0]['phone']:
|
|
|
+ share_user = sharerDuqs[0]['phone']
|
|
|
+ else:
|
|
|
+ share_user = ''
|
|
|
+ return response.json(0, {
|
|
|
+ 'deviceName': sharerDvqs[0]['NickName'],
|
|
|
+ 'deviceType': sharerDvqs[0]['Type'],
|
|
|
+ 'shareUser': share_user,
|
|
|
+ })
|
|
|
else:
|
|
|
- share_user = ''
|
|
|
- return response.json(0, {
|
|
|
- 'deviceName': sharerDvqs[0]['NickName'],
|
|
|
- 'deviceType': sharerDvqs[0]['Type'],
|
|
|
- 'shareUser': share_user,
|
|
|
- })
|
|
|
+ return response.json(173)
|
|
|
else:
|
|
|
return response.json(119)
|
|
|
else:
|