添加代码
This commit is contained in:
parent
e243749f00
commit
9632ee8094
|
|
@ -22,7 +22,7 @@ router = APIRouter(prefix="/api", tags=["用户模块"])
|
||||||
|
|
||||||
|
|
||||||
@router.post("/register/user", summary="注册用户", name="注册用户")
|
@router.post("/register/user", summary="注册用户", name="注册用户")
|
||||||
def register(user: Annotated[UserFrom, Body(...)], db: Session = Depends(get_db)):
|
async def register(user: Annotated[UserFrom, Body(...)], db: Session = Depends(get_db)):
|
||||||
user = user_service(db, user)
|
user = user_service(db, user)
|
||||||
if isinstance(user,dict):
|
if isinstance(user,dict):
|
||||||
return success_200(data=user, message="用户注册成功")
|
return success_200(data=user, message="用户注册成功")
|
||||||
|
|
@ -30,7 +30,7 @@ def register(user: Annotated[UserFrom, Body(...)], db: Session = Depends(get_db)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/login", summary="用户登录", name="用户登录")
|
@router.post("/login", summary="用户登录", name="用户登录")
|
||||||
def login(user: OAuth2PasswordRequestForm = Depends(), db: Session = Depends(get_db)):
|
async def login(user: OAuth2PasswordRequestForm = Depends(), db: Session = Depends(get_db)):
|
||||||
user = login_user(db, user.username, user.password)
|
user = login_user(db, user.username, user.password)
|
||||||
if user[0]:
|
if user[0]:
|
||||||
expire_time = timedelta(minutes=settings.ACCESS.ACCESS_TOKEN_EXPIRE_MINUTES)
|
expire_time = timedelta(minutes=settings.ACCESS.ACCESS_TOKEN_EXPIRE_MINUTES)
|
||||||
|
|
|
||||||
|
|
@ -542,3 +542,49 @@
|
||||||
2022-05-29 12:16:37 | MainThread:8636753408 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000
|
2022-05-29 12:16:37 | MainThread:8636753408 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000
|
||||||
2022-05-29 12:16:37 | MainThread:8636753408 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs
|
2022-05-29 12:16:37 | MainThread:8636753408 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs
|
||||||
2022-05-29 12:16:37 | MainThread:8636753408 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc
|
2022-05-29 12:16:37 | MainThread:8636753408 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc
|
||||||
|
2022-05-29 12:33:42 | MainThread:8606238208 | <module>:__init__:16 - INFO - start the automation service development environment
|
||||||
|
2022-05-29 12:33:42 | MainThread:8606238208 | <module>:__init__:22 - INFO - loading environment configuration file
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:15 - INFO - loading application configuration
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:16 - INFO - create FastApi app object
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:25 - INFO - Adding a New route success
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:26 - INFO - Start registering middleware
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:36 - INFO - Application started successfully:CORSMiddleware
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:15 - INFO - loading application configuration
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:16 - INFO - create FastApi app object
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:25 - INFO - Adding a New route success
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:26 - INFO - Start registering middleware
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:36 - INFO - Application started successfully:CORSMiddleware
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs
|
||||||
|
2022-05-29 12:33:43 | MainThread:8606238208 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | <module>:__init__:16 - INFO - start the automation service development environment
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | <module>:__init__:22 - INFO - loading environment configuration file
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:15 - INFO - loading application configuration
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:16 - INFO - create FastApi app object
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:25 - INFO - Adding a New route success
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:26 - INFO - Start registering middleware
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:36 - INFO - Application started successfully:CORSMiddleware
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs
|
||||||
|
2022-05-29 12:33:47 | MainThread:8643274240 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc
|
||||||
|
2022-05-29 12:33:47 | MainThread:8598930944 | <module>:__init__:16 - INFO - start the automation service development environment
|
||||||
|
2022-05-29 12:33:47 | MainThread:8598930944 | <module>:__init__:22 - INFO - loading environment configuration file
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:15 - INFO - loading application configuration
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:16 - INFO - create FastApi app object
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:25 - INFO - Adding a New route success
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:26 - INFO - Start registering middleware
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:36 - INFO - Application started successfully:CORSMiddleware
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:15 - INFO - loading application configuration
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:16 - INFO - create FastApi app object
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:25 - INFO - Adding a New route success
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:26 - INFO - Start registering middleware
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:36 - INFO - Application started successfully:CORSMiddleware
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs
|
||||||
|
2022-05-29 12:33:48 | MainThread:8598930944 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue