编写日报小程序
This commit is contained in:
parent
ea2e76b097
commit
b3f4801d99
|
@ -34,6 +34,7 @@ def daily_add(req: DailySchemas.DailyAddReq, db: Session = Depends(get_db),
|
|||
if req.fill_user != token_data.openid:
|
||||
raise HTTPException(detail="填报人与id不符", status_code=305)
|
||||
# 本部门填报权限
|
||||
print(token_data.department,token_data,"token_data.departmentxx")
|
||||
if str(req.department) not in token_data.department and not check_auth(token_data.auth_data, ['7']):
|
||||
raise HTTPException(detail="没有本部门填报权限", status_code=305)
|
||||
new_daily=DailyCrud.daily_add(db, req.dict())
|
||||
|
|
|
@ -81,7 +81,11 @@ def bind_email(req: UserSchemas.BindEmailReq, token_data: TokenData = Depends(to
|
|||
raise HTTPException(detail="邮箱验证码错误", status_code=303)
|
||||
UserCrud.update_user_info_from_email(db, token_data.openid, req.email)
|
||||
auth_data = AuthCrud.get_user_auth(db, token_data.openid)
|
||||
token = create_token({'openid': token_data.openid, 'registered': True, 'auth_data': auth_data})
|
||||
user = UserCrud.get_user_info(db, token_data.openid)
|
||||
user_data = user.to_dict()
|
||||
user_data["auth_data"] = auth_data
|
||||
token_data = TokenData(**user_data)
|
||||
token = create_token(token_data)
|
||||
return {'msg': "修改成功", 'state': 1, 'data': {'token': token}}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue