From 7a39ed5986c56e059eea392782081a7271039e5c Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 24 Feb 2022 21:55:20 +0800 Subject: [PATCH] bugfix --- appPublic/uniqueID.py | 19 ++++--------------- requirements.txt | 1 + 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/appPublic/uniqueID.py b/appPublic/uniqueID.py index 4b623d0..cb91ca6 100644 --- a/appPublic/uniqueID.py +++ b/appPublic/uniqueID.py @@ -1,20 +1,9 @@ import uuid - -node = None +from nanoid import generate def setNode(n='ff001122334455'): - global node - if len(n)>12: - return - for c in n: - if c not in ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']: - return - node = eval('0x' + n + 'L') + pass -def getID(): - global node - if node is None: - node = uuid.getnode() - u = uuid.uuid1(node) - return u.hex +def getID(size=21): + return generate(size=size) diff --git a/requirements.txt b/requirements.txt index 211baf7..e4eaf90 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ xlrd xlwt +naroid psutil ujson numpy