文件收集模块
This commit is contained in:
parent
6d0f94fa6d
commit
56da6b2ea2
|
@ -17,8 +17,7 @@ from . import schemas
|
||||||
base_url = 'http://127.0.0.1:8848/wd-rating-manage-web/data_collection'
|
base_url = 'http://127.0.0.1:8848/wd-rating-manage-web/data_collection'
|
||||||
router = APIRouter(tags=["数据收集接口"], prefix='/data_collection')
|
router = APIRouter(tags=["数据收集接口"], prefix='/data_collection')
|
||||||
need_files = [
|
need_files = [
|
||||||
{"name": "资产负债表", "file_name": "资产负债表.xlsx", "path": ""},
|
{"name": "填报模板", "file_name": "填报模板.xlsx", "path": "/static/填报模板.xlsx"},
|
||||||
{"name": "利润表", "file_name": "利润表.xlsx", "path": ""},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,20 +45,47 @@ def get_login_verify_code(body: schemas.GetLoginVerifyCodeReq, db: Session = Dep
|
||||||
return {"msg": f"验证码已发送至{'邮箱' if account_type == 'email' else '手机'},请查看", "state": 1}
|
return {"msg": f"验证码已发送至{'邮箱' if account_type == 'email' else '手机'},请查看", "state": 1}
|
||||||
|
|
||||||
|
|
||||||
|
# @router.post('/login_by_verify_code', tags=["用户登录"], summary='验证码登录接口')
|
||||||
|
# def login_by_verify_code(req: schemas.LoginByVerifyCode,
|
||||||
|
# db: Session = Depends(get_db)):
|
||||||
|
# account = req.account
|
||||||
|
# if phone_verify_code.check_code(account, req.code, PhoneVerifyType.login):
|
||||||
|
# account_type = 'phone'
|
||||||
|
# else:
|
||||||
|
# if email_verify_code.check_code(account, req.code, EmailVerifyType.login):
|
||||||
|
# account_type = 'email'
|
||||||
|
# else:
|
||||||
|
# raise HTTPException(detail="验证码错误", status_code=303)
|
||||||
|
# user = None
|
||||||
|
# if account_type == 'phone':
|
||||||
|
# user = db.query(User).filter(User.phone == account).first()
|
||||||
|
# if account_type == 'email':
|
||||||
|
# user = db.query(User).filter(User.email == account).first()
|
||||||
|
# if not user:
|
||||||
|
# raise HTTPException(detail="账号未录入系统", status_code=303)
|
||||||
|
# auth_data = user_crud.get_user_auth(user)
|
||||||
|
# user_data = user.to_full_dict(relation_use_id=True)
|
||||||
|
# user_data["auth_data"] = auth_data
|
||||||
|
# token_data = auth_util.tokenDataModel(**user_data).dict()
|
||||||
|
# token = auth_util.create_token(token_data)
|
||||||
|
# return {'token': token, 'user_info': user_data}
|
||||||
|
|
||||||
|
|
||||||
|
# 改为了只允许邮箱登录
|
||||||
@router.post('/login_by_verify_code', tags=["用户登录"], summary='验证码登录接口')
|
@router.post('/login_by_verify_code', tags=["用户登录"], summary='验证码登录接口')
|
||||||
def login_by_verify_code(req: schemas.LoginByVerifyCode,
|
def login_by_verify_code(req: schemas.LoginByVerifyCode,
|
||||||
db: Session = Depends(get_db)):
|
db: Session = Depends(get_db)):
|
||||||
account = req.account
|
account = req.account
|
||||||
if phone_verify_code.check_code(account, req.code, PhoneVerifyType.login):
|
# if phone_verify_code.check_code(account, req.code, PhoneVerifyType.login):
|
||||||
account_type = 'phone'
|
# account_type = 'phone'
|
||||||
|
# else:
|
||||||
|
if email_verify_code.check_code(account, req.code, EmailVerifyType.login):
|
||||||
|
account_type = 'email'
|
||||||
else:
|
else:
|
||||||
if email_verify_code.check_code(account, req.code, EmailVerifyType.login):
|
raise HTTPException(detail="验证码错误", status_code=303)
|
||||||
account_type = 'email'
|
|
||||||
else:
|
|
||||||
raise HTTPException(detail="验证码错误", status_code=303)
|
|
||||||
user = None
|
user = None
|
||||||
if account_type == 'phone':
|
# if account_type == 'phone':
|
||||||
user = db.query(User).filter(User.phone == account).first()
|
# user = db.query(User).filter(User.phone == account).first()
|
||||||
if account_type == 'email':
|
if account_type == 'email':
|
||||||
user = db.query(User).filter(User.email == account).first()
|
user = db.query(User).filter(User.email == account).first()
|
||||||
if not user:
|
if not user:
|
||||||
|
|
Loading…
Reference in New Issue