|
@@ -268,10 +268,12 @@ class EquipmentManagerV3(View):
|
|
|
|
|
|
try:
|
|
|
add_success_flag = False # 添加成功标识
|
|
|
+ exception_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 # 重置异常标识
|
|
|
UID = uid_content['uid']
|
|
|
NickName = uid_content['nickName']
|
|
|
Type = uid_content['type']
|
|
@@ -284,9 +286,6 @@ class EquipmentManagerV3(View):
|
|
|
if not all([UID, NickName, View_Account, Type, ChannelIndex]): # Type和ChannelIndex可能为0
|
|
|
return response.json(444, {'param': 'UID, NickName, View_Account, Type, ChannelIndex'})
|
|
|
|
|
|
- Type = int(Type)
|
|
|
- ChannelIndex = int(ChannelIndex)
|
|
|
-
|
|
|
if not re_uid.match(UID): # 检查uid长度
|
|
|
return response.json(444, {'error uid length': UID})
|
|
|
|
|
@@ -451,11 +450,14 @@ class EquipmentManagerV3(View):
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
res = repr(e)
|
|
|
+ exception_flag = True
|
|
|
pass
|
|
|
finally:
|
|
|
if add_success_flag: # 有一台添加成功则返回成功
|
|
|
return response.json(0, res)
|
|
|
- return response.json(500, res)
|
|
|
+ if exception_flag:
|
|
|
+ return response.json(500, res)
|
|
|
+ return response.json(0, res)
|
|
|
|
|
|
def do_modify(self, userID, request_dict, response, request):
|
|
|
token = request_dict.get('token', None)
|