|
@@ -65,8 +65,6 @@ class EquipmentManagerV3(View):
|
|
|
re_uid = re.compile(r'^[A-Za-z0-9]{20}$')
|
|
|
if re_uid.match(UID):
|
|
|
is_exist = Device_Info.objects.filter(UID=UID, userID_id=userID)
|
|
|
- asy = threading.Thread(target=ModelService.notify_alexa_add, args=(UID, userID, NickName))
|
|
|
- asy.start()
|
|
|
if is_exist:
|
|
|
# 判断设备是否已存在
|
|
|
if is_exist[0].isExist == 1:
|
|
@@ -98,6 +96,15 @@ class EquipmentManagerV3(View):
|
|
|
NickName=NickName, View_Account=View_Account,
|
|
|
View_Password=View_Password, Type=Type, ChannelIndex=ChannelIndex)
|
|
|
userDevice.save()
|
|
|
+
|
|
|
+ if not us_qs.exists():
|
|
|
+ us_qs = UidSetModel.objects.filter(uid=UID)
|
|
|
+ try:
|
|
|
+ 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))
|
|
|
# redisObj = RedisObject(db=8)
|
|
|
# redisObj.del_data(key='uid_qs_' + userID)
|
|
|
except Exception as e:
|
|
@@ -172,9 +179,9 @@ class EquipmentManagerV3(View):
|
|
|
UidSetModel.objects.create(**uid_set_create_dict)
|
|
|
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:
|
|
|
- asy = threading.Thread(target=ModelService.notify_alexa_add, args=(uid, userID, nickname))
|
|
|
- asy.start()
|
|
|
+ if deviceData is not None and deviceData.__contains__('NickName') and us_qs[0].is_alexa:
|
|
|
+ asy = threading.Thread(target=ModelService.notify_alexa_add, args=(uid, userID, nickname))
|
|
|
+ asy.start()
|
|
|
# redisObj = RedisObject(db=8)
|
|
|
# redisObj.del_data(key='uid_qs_' + userID)
|
|
|
return response.json(0, res)
|