|
@@ -17,7 +17,8 @@ from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
from Service.CommonService import CommonService
|
|
|
from Service.ModelService import ModelService
|
|
|
-import time,json
|
|
|
+import time, json
|
|
|
+
|
|
|
|
|
|
class EquipmentManagerV3(View):
|
|
|
|
|
@@ -119,7 +120,8 @@ class EquipmentManagerV3(View):
|
|
|
|
|
|
userDevice = Device_Info(id=pk, userID_id=userID, UID=UID,
|
|
|
NickName=NickName, View_Account=View_Account,
|
|
|
- View_Password=View_Password, Type=Type, ChannelIndex=ChannelIndex, vodPrimaryUserID=vodPrimaryUserID, vodPrimaryMaster=vodPrimaryMaster)
|
|
|
+ View_Password=View_Password, Type=Type, ChannelIndex=ChannelIndex,
|
|
|
+ vodPrimaryUserID=vodPrimaryUserID, vodPrimaryMaster=vodPrimaryMaster)
|
|
|
userDevice.save()
|
|
|
|
|
|
if not us_qs.exists():
|
|
@@ -138,7 +140,9 @@ class EquipmentManagerV3(View):
|
|
|
'View_Account',
|
|
|
'View_Password', 'ChannelIndex', 'Type',
|
|
|
'isShare',
|
|
|
- 'primaryUserID', 'primaryMaster', 'vodPrimaryUserID', 'vodPrimaryMaster', 'userID__userEmail',
|
|
|
+ 'primaryUserID', 'primaryMaster',
|
|
|
+ 'vodPrimaryUserID', 'vodPrimaryMaster',
|
|
|
+ 'userID__userEmail',
|
|
|
'data_joined', 'version',
|
|
|
'isVod', 'isExist')
|
|
|
dvql = CommonService.qs_to_list(dvqs)
|
|
@@ -217,7 +221,6 @@ class EquipmentManagerV3(View):
|
|
|
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:
|
|
|
-
|
|
|
asy = threading.Thread(target=ModelService.notify_alexa_add, args=(uid, userID, nickname))
|
|
|
asy.start()
|
|
|
# redisObj = RedisObject(db=8)
|
|
@@ -247,7 +250,8 @@ class EquipmentManagerV3(View):
|
|
|
dvqs = dvqs.filter(~Q(isExist=2))
|
|
|
dvql = dvqs.values('id', 'userID', 'NickName', 'UID', 'View_Account',
|
|
|
'View_Password', 'ChannelIndex', 'Type', 'isShare',
|
|
|
- 'primaryUserID', 'primaryMaster', 'data_joined', 'vodPrimaryUserID', 'vodPrimaryMaster', 'userID__userEmail',
|
|
|
+ 'primaryUserID', 'primaryMaster', 'data_joined', 'vodPrimaryUserID', 'vodPrimaryMaster',
|
|
|
+ 'userID__userEmail',
|
|
|
'version', 'isVod', 'isExist', 'NotificationMode')
|
|
|
dvls = CommonService.qs_to_list(dvql)
|
|
|
uid_list = []
|
|
@@ -293,10 +297,19 @@ class EquipmentManagerV3(View):
|
|
|
'DetectorRank': us['DetectorRank']
|
|
|
}
|
|
|
# 从uid_channel里面取出通道配置信息
|
|
|
- ucs_qs = UidChannelSetModel.objects.filter(uid__id=us['id']).values()
|
|
|
+ ucs_qs = UidChannelSetModel.objects.filter(uid__id=us['id']).values('channel', 'pir_audio', 'mic_audio',
|
|
|
+ 'battery_status', 'battery_level',
|
|
|
+ 'sleep_status', 'sleep_time',
|
|
|
+ 'light_night_model',
|
|
|
+ 'light_alarm_type',
|
|
|
+ 'light_alarm_level',
|
|
|
+ 'light_alarm_man_en',
|
|
|
+ 'light_alarm_vol',
|
|
|
+ 'light_long_light'
|
|
|
+ )
|
|
|
channels = []
|
|
|
for ucs in ucs_qs:
|
|
|
- channel = {
|
|
|
+ channels_dict = {
|
|
|
'channel': ucs['channel'],
|
|
|
'pir_audio': ucs['pir_audio'],
|
|
|
'mic_audio': ucs['mic_audio'],
|
|
@@ -311,7 +324,7 @@ class EquipmentManagerV3(View):
|
|
|
'light_alarm_vol': ucs['light_alarm_vol'],
|
|
|
'light_long_light': ucs['light_long_light']
|
|
|
}
|
|
|
- channels.append(channel)
|
|
|
+ channels.append(channels_dict)
|
|
|
uv_dict[us['uid']]['channels'] = channels
|
|
|
|
|
|
for p in dvls:
|
|
@@ -405,9 +418,10 @@ class EquipmentManagerV3(View):
|
|
|
device_qs = device_qs.filter(Q(UID__contains=fuzzy) | Q(NickName__contains=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')
|
|
|
+ 'View_Password', 'ChannelIndex', 'Type', 'isShare',
|
|
|
+ 'primaryUserID', 'primaryMaster', 'data_joined', 'vodPrimaryUserID',
|
|
|
+ 'vodPrimaryMaster', 'userID__userEmail',
|
|
|
+ 'version', 'isVod', 'isExist', 'NotificationMode')
|
|
|
|
|
|
dvls = CommonService.qs_to_list(device_qs)
|
|
|
uid_list = []
|
|
@@ -534,16 +548,16 @@ class EquipmentManagerV3(View):
|
|
|
return response.json(444)
|
|
|
|
|
|
# 加密
|
|
|
- def encrypt_pwd(self,userPwd):
|
|
|
+ def encrypt_pwd(self, userPwd):
|
|
|
for i in range(1, 4):
|
|
|
if i == 1:
|
|
|
- userPwd = RandomStr(3, False)+userPwd+RandomStr(3, False)
|
|
|
+ userPwd = RandomStr(3, False) + userPwd + RandomStr(3, False)
|
|
|
userPwd = base64.b64encode(str(userPwd).encode("utf-8")).decode('utf8')
|
|
|
if i == 2:
|
|
|
- userPwd = RandomStr(2, False)+str(userPwd)+RandomStr(2, False)
|
|
|
+ userPwd = RandomStr(2, False) + str(userPwd) + RandomStr(2, False)
|
|
|
userPwd = base64.b64encode(str(userPwd).encode("utf-8")).decode('utf8')
|
|
|
if i == 3:
|
|
|
- userPwd = RandomStr(1, False)+str(userPwd)+RandomStr(1, False)
|
|
|
+ userPwd = RandomStr(1, False) + str(userPwd) + RandomStr(1, False)
|
|
|
userPwd = base64.b64encode(str(userPwd).encode("utf-8")).decode('utf8')
|
|
|
return userPwd
|
|
|
|
|
@@ -568,4 +582,4 @@ class EquipmentManagerV3(View):
|
|
|
password = password.decode('utf-8')
|
|
|
# 去前3位,后3位
|
|
|
password = password[3:-3]
|
|
|
- return password
|
|
|
+ return password
|