|
@@ -135,6 +135,8 @@ class EquipmentManagerV3(View):
|
|
userID = tko.userID
|
|
userID = tko.userID
|
|
if userID is None:
|
|
if userID is None:
|
|
return response.json(309)
|
|
return response.json(309)
|
|
|
|
+ deviceData = None
|
|
|
|
+ dev_info_qs = None
|
|
try:
|
|
try:
|
|
# deviceData = json.loads(deviceContent)
|
|
# deviceData = json.loads(deviceContent)
|
|
deviceData = eval(deviceContent)
|
|
deviceData = eval(deviceContent)
|
|
@@ -147,7 +149,8 @@ class EquipmentManagerV3(View):
|
|
print(e)
|
|
print(e)
|
|
return response.json(177, repr(e))
|
|
return response.json(177, repr(e))
|
|
else:
|
|
else:
|
|
- qs = Device_Info.objects.filter(userID_id=userID, id=id)
|
|
|
|
|
|
+ # qs = Device_Info.objects.filter(userID_id=userID, id=id)
|
|
|
|
+ qs = dev_info_qs
|
|
res = CommonService.qs_to_dict(qs)
|
|
res = CommonService.qs_to_dict(qs)
|
|
if qs.exists():
|
|
if qs.exists():
|
|
uid = qs[0].UID
|
|
uid = qs[0].UID
|
|
@@ -155,7 +158,8 @@ class EquipmentManagerV3(View):
|
|
# 增加设备影子信息修改昵称 start
|
|
# 增加设备影子信息修改昵称 start
|
|
us_qs = UidSetModel.objects.filter(uid=uid)
|
|
us_qs = UidSetModel.objects.filter(uid=uid)
|
|
if us_qs.exists():
|
|
if us_qs.exists():
|
|
- us_qs.update(nickname=nickname)
|
|
|
|
|
|
+ if deviceData.__contains__('NickName'):
|
|
|
|
+ us_qs.update(nickname=nickname)
|
|
else:
|
|
else:
|
|
ChannelIndex = qs[0].ChannelIndex
|
|
ChannelIndex = qs[0].ChannelIndex
|
|
nowTime = int(time.time())
|
|
nowTime = int(time.time())
|
|
@@ -168,8 +172,8 @@ class EquipmentManagerV3(View):
|
|
'nickname': nickname,
|
|
'nickname': nickname,
|
|
}
|
|
}
|
|
UidSetModel.objects.create(**uid_set_create_dict)
|
|
UidSetModel.objects.create(**uid_set_create_dict)
|
|
- di_qs = Device_Info.objects.filter(UID=uid)
|
|
|
|
- di_qs.update(NickName=nickname)
|
|
|
|
|
|
+ # di_qs = Device_Info.objects.filter(UID=uid)
|
|
|
|
+ # di_qs.update(NickName=nickname)
|
|
# redisObj = RedisObject(db=8)
|
|
# redisObj = RedisObject(db=8)
|
|
# redisObj.del_data(key='uid_qs_' + userID)
|
|
# redisObj.del_data(key='uid_qs_' + userID)
|
|
return response.json(0, res)
|
|
return response.json(0, res)
|