|
@@ -269,11 +269,13 @@ class EquipmentManagerV3(View):
|
|
|
try:
|
|
|
add_success_flag = False # 添加成功标识
|
|
|
exception_flag = False # 异常标识
|
|
|
+ exists_flag = False # 已存在标识
|
|
|
uid_content_list = eval(uidContent)
|
|
|
print('uidContent: ', uid_content_list)
|
|
|
re_uid = re.compile(r'^[A-Za-z0-9]{14,20}$')
|
|
|
for uid_content in uid_content_list:
|
|
|
exception_flag = False # 重置异常标识
|
|
|
+ exists_flag = False # 已存在标识
|
|
|
UID = uid_content['uid']
|
|
|
NickName = uid_content['nickName']
|
|
|
Type = uid_content['type']
|
|
@@ -293,7 +295,8 @@ class EquipmentManagerV3(View):
|
|
|
if device_info_qs:
|
|
|
# 判断设备是否已存在
|
|
|
if device_info_qs[0].isExist == 1:
|
|
|
- res = {UID: 'device already exists!'}
|
|
|
+ exists_res = {UID: 'device already exists!'}
|
|
|
+ exists_flag = True
|
|
|
continue
|
|
|
else:
|
|
|
device_info_qs.delete()
|
|
@@ -455,6 +458,8 @@ class EquipmentManagerV3(View):
|
|
|
finally:
|
|
|
if add_success_flag: # 有一台添加成功则返回成功
|
|
|
return response.json(0, success_res)
|
|
|
+ if exists_flag: # 全部设备已存在
|
|
|
+ return response.json(174, exists_res)
|
|
|
if exception_flag:
|
|
|
return response.json(500, error_res)
|
|
|
return response.json(0, res)
|