日报添加字段
This commit is contained in:
parent
d67e8670a4
commit
dd9b3d5502
Binary file not shown.
|
@ -61,6 +61,11 @@ def change_user_daily_fill_notice(db: Session, email: str, daily_fill_notice: bo
|
|||
db.commit()
|
||||
|
||||
|
||||
def set_user_openid(db: Session, email: str, openid: str):
|
||||
db.query(User).filter_by(email=email).update({'openid': openid})
|
||||
db.commit()
|
||||
|
||||
|
||||
# 根据email从用户信息表内配置用户数据,相当于用户接入后的数据库操作
|
||||
def update_user_info_from_email(db: Session, email: str):
|
||||
user_info = db.query(UserInfo).filter_by(email=email).first()
|
||||
|
|
|
@ -6,7 +6,7 @@ from Utils.SqlAlchemyUtils import Base
|
|||
|
||||
class User(Base):
|
||||
__tablename__ = "user"
|
||||
# openid = Column(String(255), primary_key=True, comment="用户OpenID")
|
||||
openid = Column(String(255), primary_key=True, comment="用户OpenID")
|
||||
email = Column(String(255), primary_key=True, comment="邮箱")
|
||||
phone = Column(String(255), comment="手机号")
|
||||
name = Column(String(32), comment="用户名")
|
||||
|
|
|
@ -256,6 +256,17 @@ def change_user_daily_fill_notice(body: UserSchemas.ChangeUserDailyFillNoticeReq
|
|||
return {"msg": "修改成功", "state": 1}
|
||||
|
||||
|
||||
@router.post("/set_user_openid", tags=["用户接口"], summary="设置用户openid")
|
||||
def set_user_openid(body: UserSchemas.SetUserOpenidReq,
|
||||
token_data: TokenData = Depends(token_data_depend),
|
||||
db: Session = Depends(get_db)):
|
||||
openid = code2Session(body.code).openid
|
||||
if not openid:
|
||||
raise HTTPException(detail="code无效", status_code=303)
|
||||
UserCrud.set_user_openid(db, token_data.email, openid)
|
||||
return {"msg": "修改成功", "state": 1}
|
||||
|
||||
|
||||
@router.post("/get_user_can_watch_department", tags=["获取用户可查看部门列表"], summary=['查询'])
|
||||
def get_user_can_watch_department(token_data: TokenData = Depends(token_data_depend), db: Session = Depends(get_db)):
|
||||
print(token_data)
|
||||
|
|
|
@ -53,6 +53,7 @@ class GetUserInfoRes(BaseModel):
|
|||
email: Optional[str]
|
||||
post: Optional[str]
|
||||
phone: Optional[str]
|
||||
openid: Optional[str]
|
||||
post_list: Optional[List[PostInfo]]
|
||||
name: Optional[str]
|
||||
department: Optional[str]
|
||||
|
@ -77,6 +78,7 @@ class UserInfoChange(BaseModel):
|
|||
email: str
|
||||
name: Optional[str]
|
||||
post: Optional[str]
|
||||
openid: Optional[str]
|
||||
daily_fill_notice: Optional[bool]
|
||||
manage_departments: Optional[str]
|
||||
department: Optional[str]
|
||||
|
@ -90,6 +92,7 @@ class UserInfo(BaseModel):
|
|||
post: str
|
||||
phone: Optional[str]
|
||||
daily_fill_notice: Optional[bool]
|
||||
openid: Optional[str]
|
||||
manage_departments: Optional[str]
|
||||
department: Optional[str]
|
||||
registered: Optional[bool]
|
||||
|
@ -101,6 +104,7 @@ class UserFullInfo(BaseModel):
|
|||
post_list: Optional[List[PostInfo]]
|
||||
name: Optional[str]
|
||||
phone: Optional[str]
|
||||
openid: Optional[str]
|
||||
department: Optional[str]
|
||||
daily_fill_notice: Optional[bool]
|
||||
daily_fill_notice: Optional[bool]
|
||||
|
@ -126,6 +130,11 @@ class LoginByPhoneReq(BaseModel):
|
|||
code: str
|
||||
|
||||
|
||||
class SetUserOpenidReq(BaseModel):
|
||||
# openid: str
|
||||
code:str
|
||||
|
||||
|
||||
class GetPhoneVerifyCodeReq(BaseModel):
|
||||
phone: str
|
||||
|
||||
|
|
Loading…
Reference in New Issue