添加AccountPhoneapp,AccountToutiaoapp,AccountWebapp,AccountWxapp,AccountXzapp,Account等数据模型
This commit is contained in:
parent
513aef0fdf
commit
58314c5ee9
5
main.py
5
main.py
@ -1,9 +1,9 @@
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
from mooc.db.database import init_db
|
||||||
from mooc.api.v1.api import api_router
|
from mooc.api.v1.api import api_router
|
||||||
from mooc.core.config import settings
|
from mooc.core.config import settings
|
||||||
from mooc.db.database import init_db
|
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="ExamService",
|
title="ExamService",
|
||||||
@ -19,6 +19,7 @@ app.add_middleware(
|
|||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# 初始化数据库
|
# 初始化数据库
|
||||||
init_db()
|
init_db()
|
||||||
|
|
||||||
@ -29,4 +30,4 @@ async def root():
|
|||||||
return {"message": "Welcome to ExamService API"}
|
return {"message": "Welcome to ExamService API"}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
uvicorn.run('main:app', host='0.0.0.0', port=2333, reload=True, workers=1)
|
uvicorn.run('main:app', host='0.0.0.0', port=8000, reload=True, workers=1)
|
@ -1,5 +1,5 @@
|
|||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
from mooc.api.v1.endpoints import admin, wechat
|
from mooc.api.v1.endpoints import admin, wechat, account
|
||||||
|
|
||||||
api_router = APIRouter()
|
api_router = APIRouter()
|
||||||
|
|
||||||
@ -10,5 +10,18 @@ api_router.include_router(
|
|||||||
tags=["admins"]
|
tags=["admins"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
api_router.include_router(
|
||||||
|
wechat.router,
|
||||||
|
prefix="/wechat",
|
||||||
|
tags=["wechat"]
|
||||||
|
)
|
||||||
|
|
||||||
|
# 注册账号路由
|
||||||
|
api_router.include_router(
|
||||||
|
account.account_router,
|
||||||
|
prefix="/accounts",
|
||||||
|
tags=["accounts"]
|
||||||
|
)
|
||||||
|
|
||||||
# Add WeChat endpoints
|
# Add WeChat endpoints
|
||||||
api_router.include_router(wechat.router, prefix="/wechat", tags=["wechat"])
|
api_router.include_router(wechat.router, prefix="/wechat", tags=["wechat"])
|
78
mooc/api/v1/endpoints/account.py
Normal file
78
mooc/api/v1/endpoints/account.py
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
from typing import List
|
||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from mooc.api import deps
|
||||||
|
from mooc.crud.crud_account import ims_account_baiduapp
|
||||||
|
from mooc.schemas.account import AccountBaiduappCreate, AccountBaiduappRead, AccountBaiduappUpdate
|
||||||
|
|
||||||
|
account_router = APIRouter()
|
||||||
|
|
||||||
|
@account_router.post("/baiduapp", response_model=AccountBaiduappRead)
|
||||||
|
def create_baiduapp(
|
||||||
|
*,
|
||||||
|
db: Session = Depends(deps.get_db),
|
||||||
|
baiduapp_in: AccountBaiduappCreate,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
创建百度小程序账号
|
||||||
|
"""
|
||||||
|
baiduapp = ims_account_baiduapp.create(db=db, obj_in=baiduapp_in)
|
||||||
|
return baiduapp
|
||||||
|
|
||||||
|
@account_router.get("/baiduapp/{acid}", response_model=AccountBaiduappRead)
|
||||||
|
def read_baiduapp(
|
||||||
|
*,
|
||||||
|
db: Session = Depends(deps.get_db),
|
||||||
|
acid: int,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
获取百度小程序账号信息
|
||||||
|
"""
|
||||||
|
baiduapp = ims_account_baiduapp.get(db=db, acid=acid)
|
||||||
|
if not baiduapp:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=404,
|
||||||
|
detail="Baidu app not found"
|
||||||
|
)
|
||||||
|
return baiduapp
|
||||||
|
|
||||||
|
@account_router.put("/baiduapp/{acid}", response_model=AccountBaiduappRead)
|
||||||
|
def update_baiduapp(
|
||||||
|
*,
|
||||||
|
db: Session = Depends(deps.get_db),
|
||||||
|
acid: int,
|
||||||
|
baiduapp_in: AccountBaiduappUpdate,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
更新百度小程序账号信息
|
||||||
|
"""
|
||||||
|
baiduapp = ims_account_baiduapp.get(db=db, acid=acid)
|
||||||
|
if not baiduapp:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=404,
|
||||||
|
detail="Baidu app not found"
|
||||||
|
)
|
||||||
|
baiduapp = ims_account_baiduapp.update(
|
||||||
|
db=db,
|
||||||
|
db_obj=baiduapp,
|
||||||
|
obj_in=baiduapp_in
|
||||||
|
)
|
||||||
|
return baiduapp
|
||||||
|
|
||||||
|
@account_router.delete("/baiduapp/{acid}", response_model=AccountBaiduappRead)
|
||||||
|
def delete_baiduapp(
|
||||||
|
*,
|
||||||
|
db: Session = Depends(deps.get_db),
|
||||||
|
acid: int,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
删除百度小程序账号
|
||||||
|
"""
|
||||||
|
baiduapp = ims_account_baiduapp.get(db=db, acid=acid)
|
||||||
|
if not baiduapp:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=404,
|
||||||
|
detail="Baidu app not found"
|
||||||
|
)
|
||||||
|
baiduapp = ims_account_baiduapp.delete(db=db, acid=acid)
|
||||||
|
return baiduapp
|
@ -1,8 +1,36 @@
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from mooc.models.account import AccountWechats
|
from mooc.models.account import (
|
||||||
from mooc.schemas.account import AccountWechatsCreate, AccountWechatsUpdate
|
AccountWechats,
|
||||||
|
AccountAliapp,
|
||||||
|
AccountBaiduapp,
|
||||||
|
AccountPhoneapp,
|
||||||
|
AccountToutiaoapp,
|
||||||
|
AccountWebapp,
|
||||||
|
Account,
|
||||||
|
AccountWxapp,
|
||||||
|
AccountXzapp
|
||||||
|
)
|
||||||
|
from mooc.schemas.account import (
|
||||||
|
AccountWechatsCreate,
|
||||||
|
AccountWechatsUpdate,
|
||||||
|
AccountAliappCreate,
|
||||||
|
AccountAliappUpdate,
|
||||||
|
AccountBaiduappCreate,
|
||||||
|
AccountBaiduappUpdate,
|
||||||
|
AccountPhoneappCreate,
|
||||||
|
AccountPhoneappUpdate,
|
||||||
|
AccountToutiaoappCreate,
|
||||||
|
AccountToutiaoappUpdate,
|
||||||
|
AccountWebappCreate,
|
||||||
|
AccountWebappUpdate,
|
||||||
|
AccountXzappCreate,
|
||||||
|
AccountXzappUpdate,
|
||||||
|
AccountWxappCreate,
|
||||||
|
AccountWxappUpdate
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
class CRUDAccountWechats:
|
class CRUDAccountWechats:
|
||||||
def create(self, db: Session, obj_in: AccountWechatsCreate) -> AccountWechats:
|
def create(self, db: Session, obj_in: AccountWechatsCreate) -> AccountWechats:
|
||||||
@ -31,4 +59,218 @@ class CRUDAccountWechats:
|
|||||||
db.delete(obj)
|
db.delete(obj)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
class CRUDAccountAliapp:
|
||||||
|
def create(self, db: Session, obj_in: AccountAliappCreate) -> AccountAliapp:
|
||||||
|
db_obj = AccountAliapp(**obj_in.dict())
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def get(self, db: Session, acid: int) -> Optional[AccountAliapp]:
|
||||||
|
return db.query(AccountAliapp).filter(AccountAliapp.acid == acid).first()
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self, db: Session, *, db_obj: AccountAliapp, obj_in: AccountAliappUpdate
|
||||||
|
) -> AccountAliapp:
|
||||||
|
for field, value in obj_in.dict(exclude_unset=True).items():
|
||||||
|
setattr(db_obj, field, value)
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def delete(self, db: Session, acid: int) -> None:
|
||||||
|
obj = db.query(AccountAliapp).filter(AccountAliapp.acid == acid).first()
|
||||||
|
if obj:
|
||||||
|
db.delete(obj)
|
||||||
|
db.commit()
|
||||||
|
class CRUDAccountBaiduapp:
|
||||||
|
def create(self, db: Session, obj_in: AccountBaiduappCreate) -> AccountBaiduapp:
|
||||||
|
db_obj = AccountBaiduapp(**obj_in.dict())
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def get(self, db: Session, acid: int) -> Optional[AccountBaiduapp]:
|
||||||
|
return db.query(AccountBaiduapp).filter(AccountBaiduapp.acid == acid).first()
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self, db: Session, *, db_obj: AccountBaiduapp, obj_in: AccountBaiduappUpdate
|
||||||
|
) -> AccountBaiduapp:
|
||||||
|
for field, value in obj_in.dict(exclude_unset=True).items():
|
||||||
|
setattr(db_obj, field, value)
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def delete(self, db: Session, acid: int) -> None:
|
||||||
|
obj = db.query(AccountBaiduapp).filter(AccountBaiduapp.acid == acid).first()
|
||||||
|
if obj:
|
||||||
|
db.delete(obj)
|
||||||
|
db.commit()
|
||||||
|
class CRUDAccountPhoneapp:
|
||||||
|
def create(self, db: Session, obj_in: AccountPhoneappCreate) -> AccountPhoneapp:
|
||||||
|
db_obj = AccountPhoneapp(**obj_in.dict())
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def get(self, db: Session, acid: int) -> Optional[AccountPhoneapp]:
|
||||||
|
return db.query(AccountPhoneapp).filter(AccountPhoneapp.acid == acid).first()
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self, db: Session, *, db_obj: AccountPhoneapp, obj_in: AccountPhoneappUpdate
|
||||||
|
) -> AccountPhoneapp:
|
||||||
|
for field, value in obj_in.dict(exclude_unset=True).items():
|
||||||
|
setattr(db_obj, field, value)
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def delete(self, db: Session, acid: int) -> None:
|
||||||
|
obj = db.query(AccountPhoneapp).filter(AccountPhoneapp.acid == acid).first()
|
||||||
|
if obj:
|
||||||
|
db.delete(obj)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
class CRUDAccountToutiaoapp:
|
||||||
|
def create(self, db: Session, obj_in: AccountToutiaoappCreate) -> AccountToutiaoapp:
|
||||||
|
db_obj = AccountToutiaoapp(**obj_in.dict())
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def get(self, db: Session, acid: int) -> Optional[AccountToutiaoapp]:
|
||||||
|
return db.query(AccountToutiaoapp).filter(AccountToutiaoapp.acid == acid).first()
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self, db: Session, *, db_obj: AccountToutiaoapp, obj_in: AccountToutiaoappUpdate
|
||||||
|
) -> AccountToutiaoapp:
|
||||||
|
for field, value in obj_in.dict(exclude_unset=True).items():
|
||||||
|
setattr(db_obj, field, value)
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def delete(self, db: Session, acid: int) -> None:
|
||||||
|
obj = db.query(AccountToutiaoapp).filter(AccountToutiaoapp.acid == acid).first()
|
||||||
|
if obj:
|
||||||
|
db.delete(obj)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
class CRUDAccount:
|
||||||
|
def get_by_uniacid(self, db: Session, *, uniacid: int) -> Optional[Account]:
|
||||||
|
return db.query(Account).filter(Account.uniacid == uniacid).first()
|
||||||
|
|
||||||
|
account = CRUDAccount()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CRUDAccountWebapp:
|
||||||
|
def create(self, db: Session, *, obj_in: AccountWebappCreate) -> AccountWebapp:
|
||||||
|
db_obj = AccountWebapp(**obj_in.dict())
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def get(self, db: Session, acid: int) -> Optional[AccountWebapp]:
|
||||||
|
return db.query(AccountWebapp).filter(AccountWebapp.acid == acid).first()
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self,
|
||||||
|
db: Session,
|
||||||
|
*,
|
||||||
|
db_obj: AccountWebapp,
|
||||||
|
obj_in: AccountWebappUpdate
|
||||||
|
) -> AccountWebapp:
|
||||||
|
data = obj_in.dict(exclude_unset=True)
|
||||||
|
for field, value in data.items():
|
||||||
|
setattr(db_obj, field, value)
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def delete(self, db: Session, acid: int) -> None:
|
||||||
|
obj = db.query(AccountWebapp).filter(AccountWebapp.acid == acid).first()
|
||||||
|
if obj:
|
||||||
|
db.delete(obj)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CRUDAccountWxapp:
|
||||||
|
def create(self, db: Session, obj_in: AccountWxappCreate) -> AccountWxapp:
|
||||||
|
db_obj = AccountWxapp(**obj_in.dict())
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def get(self, db: Session, acid: int) -> Optional[AccountWxapp]:
|
||||||
|
return db.query(AccountWxapp).filter(AccountWxapp.acid == acid).first()
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self, db: Session, *, db_obj: AccountWxapp, obj_in: AccountWxappUpdate
|
||||||
|
) -> AccountWxapp:
|
||||||
|
for field, value in obj_in.dict(exclude_unset=True).items():
|
||||||
|
setattr(db_obj, field, value)
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def delete(self, db: Session, acid: int) -> None:
|
||||||
|
obj = db.query(AccountWxapp).filter(AccountWxapp.acid == acid).first()
|
||||||
|
if obj:
|
||||||
|
db.delete(obj)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
class CRUDAccountXzapp:
|
||||||
|
def create(self, db: Session, obj_in: AccountXzappCreate) -> AccountXzapp:
|
||||||
|
db_obj = AccountXzapp(**obj_in.dict())
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def get(self, db: Session, acid: int) -> Optional[AccountXzapp]:
|
||||||
|
return db.query(AccountXzapp).filter(AccountXzapp.acid == acid).first()
|
||||||
|
|
||||||
|
def update(
|
||||||
|
self, db: Session, *, db_obj: AccountXzapp, obj_in: AccountXzappUpdate
|
||||||
|
) -> AccountXzapp:
|
||||||
|
for field, value in obj_in.dict(exclude_unset=True).items():
|
||||||
|
setattr(db_obj, field, value)
|
||||||
|
db.add(db_obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(db_obj)
|
||||||
|
return db_obj
|
||||||
|
|
||||||
|
def delete(self, db: Session, acid: int) -> None:
|
||||||
|
obj = db.query(AccountXzapp).filter(AccountXzapp.acid == acid).first()
|
||||||
|
if obj:
|
||||||
|
db.delete(obj)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
# 在文件末尾添加实例
|
||||||
|
account_wxapp = CRUDAccountWxapp()
|
||||||
|
account_xzapp = CRUDAccountXzapp()
|
||||||
|
account_webapp = CRUDAccountWebapp()
|
||||||
|
|
||||||
account_wechats = CRUDAccountWechats()
|
account_wechats = CRUDAccountWechats()
|
||||||
|
ims_account_aliapp = CRUDAccountAliapp()
|
||||||
|
ims_account_baiduapp = CRUDAccountBaiduapp()
|
||||||
|
ims_account_phoneapp = CRUDAccountPhoneapp()
|
||||||
|
ims_account_toutiaoapp = CRUDAccountToutiaoapp()
|
@ -1,7 +1,7 @@
|
|||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from mooc.models.admin import Admin,Account,AccountWebapp
|
from mooc.models.admin import Admin
|
||||||
from mooc.schemas.admin import AdminCreate, AdminUpdate,AccountCreate, AccountUpdate, AccountWebappCreate, AccountWebappUpdate
|
from mooc.schemas.admin import AdminCreate, AdminUpdate
|
||||||
|
|
||||||
|
|
||||||
class CRUDAdmin:
|
class CRUDAdmin:
|
||||||
@ -20,7 +20,7 @@ class CRUDAdmin:
|
|||||||
db_obj = Admin(
|
db_obj = Admin(
|
||||||
weid=obj_in.weid,
|
weid=obj_in.weid,
|
||||||
username=obj_in.username,
|
username=obj_in.username,
|
||||||
password=obj_in.password, # ע<>⣺ʵ<E2A3BA><CAB5>ʹ<EFBFBD><CAB9>ʱӦ<CAB1>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>?
|
password=obj_in.password,
|
||||||
pcate_id=obj_in.pcate_id,
|
pcate_id=obj_in.pcate_id,
|
||||||
cate_id=obj_in.cate_id,
|
cate_id=obj_in.cate_id,
|
||||||
relation_id=obj_in.relation_id,
|
relation_id=obj_in.relation_id,
|
||||||
@ -52,47 +52,3 @@ class CRUDAdmin:
|
|||||||
|
|
||||||
admin = CRUDAdmin()
|
admin = CRUDAdmin()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CRUDAccount:
|
|
||||||
def get_by_uniacid(self, db: Session, *, uniacid: int) -> Optional[Account]:
|
|
||||||
return db.query(Account).filter(Account.uniacid == uniacid).first()
|
|
||||||
|
|
||||||
account = CRUDAccount()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CRUDAccountWebapp:
|
|
||||||
def create(self, db: Session, *, obj_in: AccountWebappCreate) -> AccountWebapp:
|
|
||||||
db_obj = AccountWebapp(**obj_in.dict())
|
|
||||||
db.add(db_obj)
|
|
||||||
db.commit()
|
|
||||||
db.refresh(db_obj)
|
|
||||||
return db_obj
|
|
||||||
|
|
||||||
def get(self, db: Session, acid: int) -> Optional[AccountWebapp]:
|
|
||||||
return db.query(AccountWebapp).filter(AccountWebapp.acid == acid).first()
|
|
||||||
|
|
||||||
def update(
|
|
||||||
self,
|
|
||||||
db: Session,
|
|
||||||
*,
|
|
||||||
db_obj: AccountWebapp,
|
|
||||||
obj_in: AccountWebappUpdate
|
|
||||||
) -> AccountWebapp:
|
|
||||||
data = obj_in.dict(exclude_unset=True)
|
|
||||||
for field, value in data.items():
|
|
||||||
setattr(db_obj, field, value)
|
|
||||||
db.add(db_obj)
|
|
||||||
db.commit()
|
|
||||||
db.refresh(db_obj)
|
|
||||||
return db_obj
|
|
||||||
|
|
||||||
def delete(self, db: Session, acid: int) -> None:
|
|
||||||
obj = db.query(AccountWebapp).filter(AccountWebapp.acid == acid).first()
|
|
||||||
if obj:
|
|
||||||
db.delete(obj)
|
|
||||||
db.commit()
|
|
||||||
|
|
||||||
account_webapp = CRUDAccountWebapp()
|
|
@ -1,5 +1,13 @@
|
|||||||
from mooc.db.database import Base
|
from mooc.db.database import Base
|
||||||
|
from mooc.models.admin import Admin
|
||||||
# 导入所有模型以注册到Base.metadata
|
from mooc.models.account import (
|
||||||
from mooc.models.admin import Admin, Account, AccountWebapp
|
AccountWechats,
|
||||||
from mooc.models.account import AccountWechats
|
AccountAliapp,
|
||||||
|
AccountBaiduapp,
|
||||||
|
AccountPhoneapp,
|
||||||
|
AccountToutiaoapp,
|
||||||
|
AccountWebapp,
|
||||||
|
AccountWxapp,
|
||||||
|
AccountXzapp,
|
||||||
|
Account,
|
||||||
|
)
|
@ -27,3 +27,128 @@ class AccountWechats(Base):
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class AccountAliapp(Base):
|
||||||
|
__tablename__ = 'ims_account_aliapp'
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True)
|
||||||
|
uniacid = Column(Integer, nullable=False)
|
||||||
|
level = Column(SmallInteger, nullable=False)
|
||||||
|
name = Column(String(30), nullable=False)
|
||||||
|
description = Column(String(255), nullable=False)
|
||||||
|
key = Column(String(16), nullable=False)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountBaiduapp(Base):
|
||||||
|
__tablename__ = "ims_account_baiduapp"
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True)
|
||||||
|
uniacid = Column(Integer, index=True, nullable=False)
|
||||||
|
name = Column(String(30), nullable=False)
|
||||||
|
appid = Column(String(32), nullable=False)
|
||||||
|
key = Column(String(32), nullable=False)
|
||||||
|
secret = Column(String(32), nullable=False)
|
||||||
|
description = Column(String(255), nullable=False)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
class AccountPhoneapp(Base):
|
||||||
|
__tablename__ = "ims_account_phoneapp"
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True)
|
||||||
|
uniacid = Column(Integer, index=True, nullable=False)
|
||||||
|
name = Column(String(255), nullable=False)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountToutiaoapp(Base):
|
||||||
|
__tablename__ = "ims_account_toutiaoapp"
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True)
|
||||||
|
uniacid = Column(Integer, index=True, nullable=False)
|
||||||
|
name = Column(String(30), nullable=False)
|
||||||
|
appid = Column(String(32), nullable=False)
|
||||||
|
key = Column(String(32), nullable=False)
|
||||||
|
secret = Column(String(50), nullable=False)
|
||||||
|
description = Column(String(255), nullable=False)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Account(Base):
|
||||||
|
__tablename__ = "ims_account"
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
uniacid = Column(Integer, nullable=False, index=True)
|
||||||
|
hash = Column(String(8), nullable=False)
|
||||||
|
type = Column(SmallInteger, nullable=False)
|
||||||
|
isconnect = Column(SmallInteger, nullable=False)
|
||||||
|
isdeleted = Column(SmallInteger, nullable=False)
|
||||||
|
endtime = Column(Integer, nullable=False)
|
||||||
|
send_account_expire_status = Column(SmallInteger, nullable=False)
|
||||||
|
send_api_expire_status = Column(SmallInteger, nullable=False)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class AccountWebapp(Base):
|
||||||
|
__tablename__ = "ims_account_webapp"
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True)
|
||||||
|
uniacid = Column(Integer, index=True)
|
||||||
|
name = Column(String(255))
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountWxapp(Base):
|
||||||
|
__tablename__ = "ims_account_wxapp"
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True)
|
||||||
|
uniacid = Column(Integer, index=True, nullable=False)
|
||||||
|
token = Column(String(32), nullable=False)
|
||||||
|
encodingaeskey = Column(String(43), nullable=False)
|
||||||
|
level = Column(SmallInteger, nullable=False)
|
||||||
|
account = Column(String(30), nullable=False)
|
||||||
|
original = Column(String(50), nullable=False)
|
||||||
|
key = Column(String(50), nullable=False)
|
||||||
|
secret = Column(String(50), nullable=False)
|
||||||
|
name = Column(String(30), nullable=False)
|
||||||
|
appdomain = Column(String(255), nullable=False)
|
||||||
|
auth_refresh_token = Column(String(255))
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountXzapp(Base):
|
||||||
|
__tablename__ = "ims_account_xzapp"
|
||||||
|
|
||||||
|
acid = Column(Integer, primary_key=True)
|
||||||
|
uniacid = Column(Integer, index=True, nullable=False)
|
||||||
|
name = Column(String(255), nullable=False)
|
||||||
|
original = Column(String(50), nullable=False)
|
||||||
|
lastupdate = Column(Integer, nullable=False)
|
||||||
|
styleid = Column(Integer, nullable=False)
|
||||||
|
createtime = Column(Integer, nullable=False)
|
||||||
|
token = Column(String(32), nullable=False)
|
||||||
|
encodingaeskey = Column(String(255), nullable=False)
|
||||||
|
xzapp_id = Column(String(30), nullable=False)
|
||||||
|
level = Column(SmallInteger, nullable=False)
|
||||||
|
key = Column(String(80), nullable=False)
|
||||||
|
secret = Column(String(80), nullable=False)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
@ -22,30 +22,3 @@ class Admin(Base):
|
|||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
class Account(Base):
|
|
||||||
__tablename__ = "ims_account"
|
|
||||||
|
|
||||||
acid = Column(Integer, primary_key=True, autoincrement=True)
|
|
||||||
uniacid = Column(Integer, nullable=False, index=True)
|
|
||||||
hash = Column(String(8), nullable=False)
|
|
||||||
type = Column(SmallInteger, nullable=False)
|
|
||||||
isconnect = Column(SmallInteger, nullable=False)
|
|
||||||
isdeleted = Column(SmallInteger, nullable=False)
|
|
||||||
endtime = Column(Integer, nullable=False)
|
|
||||||
send_account_expire_status = Column(SmallInteger, nullable=False)
|
|
||||||
send_api_expire_status = Column(SmallInteger, nullable=False)
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
from_attributes = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AccountWebapp(Base):
|
|
||||||
__tablename__ = "ims_account_webapp"
|
|
||||||
|
|
||||||
acid = Column(Integer, primary_key=True)
|
|
||||||
uniacid = Column(Integer, index=True)
|
|
||||||
name = Column(String(255))
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
from_attributes = True
|
|
@ -35,3 +35,207 @@ class AccountWechats(AccountWechatsBase):
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class AccountAliappBase(BaseModel):
|
||||||
|
uniacid: int
|
||||||
|
level: int
|
||||||
|
name: str
|
||||||
|
description: str
|
||||||
|
key: str
|
||||||
|
|
||||||
|
class AccountAliappCreate(AccountAliappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountAliappUpdate(BaseModel):
|
||||||
|
level: Optional[int]
|
||||||
|
name: Optional[str]
|
||||||
|
description: Optional[str]
|
||||||
|
key: Optional[str]
|
||||||
|
|
||||||
|
class AccountAliappRead(AccountAliappBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountBaiduappBase(BaseModel):
|
||||||
|
uniacid: int
|
||||||
|
name: str
|
||||||
|
appid: str
|
||||||
|
key: str
|
||||||
|
secret: str
|
||||||
|
description: str
|
||||||
|
|
||||||
|
class AccountBaiduappCreate(AccountBaiduappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountBaiduappUpdate(BaseModel):
|
||||||
|
name: Optional[str]
|
||||||
|
appid: Optional[str]
|
||||||
|
key: Optional[str]
|
||||||
|
secret: Optional[str]
|
||||||
|
description: Optional[str]
|
||||||
|
|
||||||
|
class AccountBaiduappRead(AccountBaiduappBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
class AccountPhoneappBase(BaseModel):
|
||||||
|
uniacid: int
|
||||||
|
name: str
|
||||||
|
|
||||||
|
class AccountPhoneappCreate(AccountPhoneappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountPhoneappUpdate(BaseModel):
|
||||||
|
name: Optional[str]
|
||||||
|
|
||||||
|
class AccountPhoneappRead(AccountPhoneappBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountToutiaoappBase(BaseModel):
|
||||||
|
uniacid: int
|
||||||
|
name: str
|
||||||
|
appid: str
|
||||||
|
key: str
|
||||||
|
secret: str
|
||||||
|
description: str
|
||||||
|
|
||||||
|
class AccountToutiaoappCreate(AccountToutiaoappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountToutiaoappUpdate(BaseModel):
|
||||||
|
name: Optional[str]
|
||||||
|
appid: Optional[str]
|
||||||
|
key: Optional[str]
|
||||||
|
secret: Optional[str]
|
||||||
|
description: Optional[str]
|
||||||
|
|
||||||
|
class AccountToutiaoappRead(AccountToutiaoappBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class AccountBase(BaseModel):
|
||||||
|
uniacid: int
|
||||||
|
hash: str
|
||||||
|
type: int
|
||||||
|
isconnect: int
|
||||||
|
isdeleted: int
|
||||||
|
endtime: int
|
||||||
|
send_account_expire_status: int
|
||||||
|
send_api_expire_status: int
|
||||||
|
|
||||||
|
class AccountCreate(AccountBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountUpdate(AccountBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Account(AccountBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class AccountWebappBase(BaseModel):
|
||||||
|
uniacid: Optional[int]
|
||||||
|
name: Optional[str]
|
||||||
|
|
||||||
|
class AccountWebappCreate(AccountWebappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountWebappUpdate(AccountWebappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountWebapp(AccountWebappBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountWxappBase(BaseModel):
|
||||||
|
uniacid: int
|
||||||
|
token: str
|
||||||
|
encodingaeskey: str
|
||||||
|
level: int
|
||||||
|
account: str
|
||||||
|
original: str
|
||||||
|
key: str
|
||||||
|
secret: str
|
||||||
|
name: str
|
||||||
|
appdomain: str
|
||||||
|
auth_refresh_token: Optional[str]
|
||||||
|
|
||||||
|
class AccountWxappCreate(AccountWxappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountWxappUpdate(BaseModel):
|
||||||
|
token: Optional[str]
|
||||||
|
encodingaeskey: Optional[str]
|
||||||
|
level: Optional[int]
|
||||||
|
account: Optional[str]
|
||||||
|
original: Optional[str]
|
||||||
|
key: Optional[str]
|
||||||
|
secret: Optional[str]
|
||||||
|
name: Optional[str]
|
||||||
|
appdomain: Optional[str]
|
||||||
|
auth_refresh_token: Optional[str]
|
||||||
|
|
||||||
|
class AccountWxappRead(AccountWxappBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
||||||
|
|
||||||
|
class AccountXzappBase(BaseModel):
|
||||||
|
uniacid: int
|
||||||
|
name: str
|
||||||
|
original: str
|
||||||
|
lastupdate: int
|
||||||
|
styleid: int
|
||||||
|
createtime: int
|
||||||
|
token: str
|
||||||
|
encodingaeskey: str
|
||||||
|
xzapp_id: str
|
||||||
|
level: int
|
||||||
|
key: str
|
||||||
|
secret: str
|
||||||
|
|
||||||
|
class AccountXzappCreate(AccountXzappBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AccountXzappUpdate(BaseModel):
|
||||||
|
name: Optional[str]
|
||||||
|
original: Optional[str]
|
||||||
|
lastupdate: Optional[int]
|
||||||
|
styleid: Optional[int]
|
||||||
|
token: Optional[str]
|
||||||
|
encodingaeskey: Optional[str]
|
||||||
|
xzapp_id: Optional[str]
|
||||||
|
level: Optional[int]
|
||||||
|
key: Optional[str]
|
||||||
|
secret: Optional[str]
|
||||||
|
|
||||||
|
class AccountXzappRead(AccountXzappBase):
|
||||||
|
acid: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
from_attributes = True
|
@ -1,8 +1,6 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
# 基础Admin模型
|
|
||||||
class AdminBase(BaseModel):
|
class AdminBase(BaseModel):
|
||||||
weid: str
|
weid: str
|
||||||
username: str
|
username: str
|
||||||
@ -11,11 +9,9 @@ class AdminBase(BaseModel):
|
|||||||
relation_id: str
|
relation_id: str
|
||||||
is_delete: int = 1
|
is_delete: int = 1
|
||||||
|
|
||||||
# 创建Admin时的请求模型
|
|
||||||
class AdminCreate(AdminBase):
|
class AdminCreate(AdminBase):
|
||||||
password: str
|
password: str
|
||||||
|
|
||||||
# 更新Admin时的请求模型
|
|
||||||
class AdminUpdate(BaseModel):
|
class AdminUpdate(BaseModel):
|
||||||
weid: Optional[str] = None
|
weid: Optional[str] = None
|
||||||
username: Optional[str] = None
|
username: Optional[str] = None
|
||||||
@ -25,7 +21,6 @@ class AdminUpdate(BaseModel):
|
|||||||
relation_id: Optional[str] = None
|
relation_id: Optional[str] = None
|
||||||
is_delete: Optional[int] = None
|
is_delete: Optional[int] = None
|
||||||
|
|
||||||
# Admin响应模型
|
|
||||||
class Admin(AdminBase):
|
class Admin(AdminBase):
|
||||||
id: int
|
id: int
|
||||||
createtime: int
|
createtime: int
|
||||||
@ -34,45 +29,3 @@ class Admin(AdminBase):
|
|||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
class AccountBase(BaseModel):
|
|
||||||
uniacid: int
|
|
||||||
hash: str
|
|
||||||
type: int
|
|
||||||
isconnect: int
|
|
||||||
isdeleted: int
|
|
||||||
endtime: int
|
|
||||||
send_account_expire_status: int
|
|
||||||
send_api_expire_status: int
|
|
||||||
|
|
||||||
class AccountCreate(AccountBase):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class AccountUpdate(AccountBase):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class Account(AccountBase):
|
|
||||||
acid: int
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
from_attributes = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AccountWebappBase(BaseModel):
|
|
||||||
uniacid: Optional[int]
|
|
||||||
name: Optional[str]
|
|
||||||
|
|
||||||
class AccountWebappCreate(AccountWebappBase):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class AccountWebappUpdate(AccountWebappBase):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class AccountWebapp(AccountWebappBase):
|
|
||||||
acid: int
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
from_attributes = True
|
|
Loading…
Reference in New Issue
Block a user