|
@@ -219,10 +219,10 @@ def do_upload_uid(request):
|
|
|
|
|
|
bulk = []
|
|
bulk = []
|
|
add_time = update_time = int(time.time())
|
|
add_time = update_time = int(time.time())
|
|
- # MAC = MacModel.objects.filter().values('id', 'value', 'is_active')[0] # 获取最新可用的mac
|
|
|
|
- # current_mac = MAC['value']
|
|
|
|
- # if (not MAC['is_active']) or (current_mac[-8:] == 'FF.FF.FF'):
|
|
|
|
- # return response.json(175)
|
|
|
|
|
|
+ MAC = MacModel.objects.filter().values('id', 'value', 'is_active')[0] # 获取最新可用的mac
|
|
|
|
+ current_mac = MAC['value']
|
|
|
|
+ if (not MAC['is_active']) or (current_mac[-8:] == 'FF.FF.FF'):
|
|
|
|
+ return response.json(175)
|
|
|
|
|
|
area = 1 if vpg_id != '1' else 0
|
|
area = 1 if vpg_id != '1' else 0
|
|
# path = '/'.join((BASE_DIR, 'static/uid')).replace('\\', '/') + '/'
|
|
# path = '/'.join((BASE_DIR, 'static/uid')).replace('\\', '/') + '/'
|
|
@@ -264,12 +264,12 @@ def do_upload_uid(request):
|
|
UID.uid = new_uid
|
|
UID.uid = new_uid
|
|
UID.full_uid_code = uid
|
|
UID.full_uid_code = uid
|
|
bulk.append(UID)
|
|
bulk.append(UID)
|
|
- # temp_mac = CommonService.updateMac(current_mac) # mac地址值+1;后3个字节为FF时返回None
|
|
|
|
- # if temp_mac:
|
|
|
|
- # current_mac = temp_mac # 更新赋值写入uid表
|
|
|
|
- # else:
|
|
|
|
- # temp_mac = current_mac # 赋值为FF写入mac表
|
|
|
|
- # break
|
|
|
|
|
|
+ temp_mac = CommonService.updateMac(current_mac) # mac地址值+1;后3个字节为FF时返回None
|
|
|
|
+ if temp_mac:
|
|
|
|
+ current_mac = temp_mac # 更新赋值写入uid表
|
|
|
|
+ else:
|
|
|
|
+ temp_mac = current_mac # 赋值为FF写入mac表
|
|
|
|
+ break
|
|
|
|
|
|
ip = CommonService.get_ip_address(request)
|
|
ip = CommonService.get_ip_address(request)
|
|
content = json.loads(json.dumps(request_dict))
|
|
content = json.loads(json.dumps(request_dict))
|
|
@@ -288,7 +288,7 @@ def do_upload_uid(request):
|
|
UIDModel.objects.bulk_create(bulk) # 批量写入uid数据
|
|
UIDModel.objects.bulk_create(bulk) # 批量写入uid数据
|
|
uid_count = UIDModel.objects.filter(vpg_id=vpg_id).count() # 获取族群下uid的数量
|
|
uid_count = UIDModel.objects.filter(vpg_id=vpg_id).count() # 获取族群下uid的数量
|
|
VPGModel.objects.filter(id=vpg_id).update(uid_count=uid_count) # 更新vgp表的uid_count
|
|
VPGModel.objects.filter(id=vpg_id).update(uid_count=uid_count) # 更新vgp表的uid_count
|
|
- # MacModel.objects.filter().update(value=temp_mac) # 更新mac表的mac地址值
|
|
|
|
|
|
+ MacModel.objects.filter().update(value=temp_mac) # 更新mac表的mac地址值
|
|
return response.json(0)
|
|
return response.json(0)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
print(e)
|
|
print(e)
|