|
@@ -64,6 +64,22 @@ class EquipmentManagerV3(View):
|
|
|
userID = tko.userID
|
|
|
re_uid = re.compile(r'^[A-Za-z0-9]{20}$')
|
|
|
if re_uid.match(UID):
|
|
|
+ try:
|
|
|
+ file_path = '/'.join((BASE_DIR, 'static/test.log'))
|
|
|
+ file = open(file_path, 'a+')
|
|
|
+ file.write(UID)
|
|
|
+ file.write('\n')
|
|
|
+ file.write(userID)
|
|
|
+ file.write('\n')
|
|
|
+ file.write(NickName)
|
|
|
+ file.write('\n')
|
|
|
+ file.flush()
|
|
|
+ file.close()
|
|
|
+
|
|
|
+ asy = threading.Thread(target=ModelService.notify_alexa_add, args=(UID, userID, NickName))
|
|
|
+ asy.start()
|
|
|
+ except Exception as e:
|
|
|
+ print(repr(e))
|
|
|
is_exist = Device_Info.objects.filter(UID=UID, userID_id=userID)
|
|
|
if is_exist:
|
|
|
# 判断设备是否已存在
|
|
@@ -97,24 +113,9 @@ class EquipmentManagerV3(View):
|
|
|
View_Password=View_Password, Type=Type, ChannelIndex=ChannelIndex)
|
|
|
userDevice.save()
|
|
|
|
|
|
- if not us_qs.exists():
|
|
|
- us_qs = UidSetModel.objects.filter(uid=UID)
|
|
|
- try:
|
|
|
- file_path = '/'.join((BASE_DIR, 'static/test.log'))
|
|
|
- file = open(file_path, 'a+')
|
|
|
- file.write(UID)
|
|
|
- file.write('\n')
|
|
|
- file.write(userID)
|
|
|
- file.write('\n')
|
|
|
- file.write(NickName)
|
|
|
- file.write('\n')
|
|
|
- file.flush()
|
|
|
- file.close()
|
|
|
- if us_qs.exists() and us_qs[0].is_alexa == 1:
|
|
|
- asy = threading.Thread(target=ModelService.notify_alexa_add, args=(UID, userID, NickName))
|
|
|
- asy.start()
|
|
|
- except Exception as e:
|
|
|
- print(repr(e))
|
|
|
+ # if not us_qs.exists():
|
|
|
+ # us_qs = UidSetModel.objects.filter(uid=UID)
|
|
|
+
|
|
|
# redisObj = RedisObject(db=8)
|
|
|
# redisObj.del_data(key='uid_qs_' + userID)
|
|
|
except Exception as e:
|