From 8eb8da852ce90d2e88796c32b61064622f97ea2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80=C3=AE=C3=97=C3=9A=C3=95=C3=B1?= Date: Thu, 18 Aug 2022 11:11:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E5=BC=95=E7=94=A8get=5Fuid?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crud/crud_api_board.py | 2 +- crud/crud_api_list.py | 6 ++++-- crud/crud_event_point.py | 2 -- crud/crud_project.py | 5 ++++- crud/crud_project_number.py | 2 -- crud/crud_space.py | 5 ++++- crud/crud_user.py | 6 ++++-- crud/user_label.py | 6 ++++-- 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/crud/crud_api_board.py b/crud/crud_api_board.py index 28b2a93..161d165 100644 --- a/crud/crud_api_board.py +++ b/crud/crud_api_board.py @@ -6,7 +6,7 @@ __all__ = 'api_board', from schemas import ProjectDB -from utils import get_uid + class CRUDProjectNumber(CRUDBase): # 获取所有数据 async def all_api(self, db: AsyncIOMotorDatabase): diff --git a/crud/crud_api_list.py b/crud/crud_api_list.py index 9275edd..346ee3e 100644 --- a/crud/crud_api_list.py +++ b/crud/crud_api_list.py @@ -1,11 +1,13 @@ from motor.motor_asyncio import AsyncIOMotorDatabase - +import time, random import schemas from crud.base import CRUDBase __all__ = 'api_list', -from utils import get_uid + +def get_uid(): + return hex(int(time.time() * 10 ** 7) + random.randint(0, 10000))[2:] class CRUDApiList(CRUDBase): diff --git a/crud/crud_event_point.py b/crud/crud_event_point.py index 26e2409..27cd702 100644 --- a/crud/crud_event_point.py +++ b/crud/crud_event_point.py @@ -4,8 +4,6 @@ from crud.base import CRUDBase __all__ = 'event_point', -from utils import get_uid - class CRUDProjectNumber(CRUDBase): # 获取对应游戏的数据,默认把基础属性的数据也获取出来 diff --git a/crud/crud_project.py b/crud/crud_project.py index a3873ec..17e74a8 100644 --- a/crud/crud_project.py +++ b/crud/crud_project.py @@ -1,3 +1,4 @@ +import time, random from motor.motor_asyncio import AsyncIOMotorDatabase from crud.base import CRUDBase @@ -5,7 +6,9 @@ from schemas import * __all__ = 'project', -from utils import get_uid + +def get_uid(): + return hex(int(time.time() * 10 ** 7) + random.randint(0, 10000))[2:] class CRUDProject(CRUDBase): diff --git a/crud/crud_project_number.py b/crud/crud_project_number.py index b375841..cb84024 100644 --- a/crud/crud_project_number.py +++ b/crud/crud_project_number.py @@ -4,8 +4,6 @@ from crud.base import CRUDBase __all__ = 'project_number', -from utils import get_uid - class CRUDProjectNumber(CRUDBase): # 获取所有数据 diff --git a/crud/crud_space.py b/crud/crud_space.py index bec447b..917da9c 100644 --- a/crud/crud_space.py +++ b/crud/crud_space.py @@ -1,3 +1,4 @@ +import time, random import pymongo from motor.motor_asyncio import AsyncIOMotorDatabase @@ -7,7 +8,9 @@ from schemas import * __all__ = 'space', -from utils import get_uid + +def get_uid(): + return hex(int(time.time() * 10 ** 7) + random.randint(0, 10000))[2:] class CRUDSpace(CRUDBase): diff --git a/crud/crud_user.py b/crud/crud_user.py index 3dd2474..e327659 100644 --- a/crud/crud_user.py +++ b/crud/crud_user.py @@ -1,6 +1,6 @@ import datetime import time -import uuid +import random from motor.motor_asyncio import AsyncIOMotorDatabase @@ -12,7 +12,9 @@ from schemas import UserCreate, UserDBRW __all__ = 'user', -from utils import get_uid + +def get_uid(): + return hex(int(time.time() * 10 ** 7) + random.randint(0, 10000))[2:] class CRUDUser(CRUDBase): diff --git a/crud/user_label.py b/crud/user_label.py index 7d6c005..e457444 100644 --- a/crud/user_label.py +++ b/crud/user_label.py @@ -1,11 +1,13 @@ from motor.motor_asyncio import AsyncIOMotorDatabase - +import time, random import schemas from crud.base import CRUDBase __all__ = 'user_label', -from utils import get_uid + +def get_uid(): + return hex(int(time.time() * 10 ** 7) + random.randint(0, 10000))[2:] class CRUDUserLabel(CRUDBase):