宇恒一号查询账号接口
This commit is contained in:
@@ -6,7 +6,7 @@ from ..core.response_code import ResponseCode, ResponseMessage
|
|||||||
from ..schemas.account import (
|
from ..schemas.account import (
|
||||||
AccountCreate, AccountUpdate, AccountResponse,
|
AccountCreate, AccountUpdate, AccountResponse,
|
||||||
AccountListRequest, AccountGetRequest, AccountUpdateRequest, AccountDeleteRequest,
|
AccountListRequest, AccountGetRequest, AccountUpdateRequest, AccountDeleteRequest,
|
||||||
AccountApiResponse, AccountListResponse
|
AccountApiResponse, AccountListResponse,AccountGetRequestYH
|
||||||
)
|
)
|
||||||
from ..services.account import AccountService
|
from ..services.account import AccountService
|
||||||
|
|
||||||
@@ -69,6 +69,31 @@ def get_account(request: AccountGetRequest, db: Session = Depends(get_db)):
|
|||||||
data=accounts
|
data=accounts
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 宇恒一号特定查询接口
|
||||||
|
@router.post("/get/yh", response_model=AccountListResponse)
|
||||||
|
def get_account(request: AccountGetRequestYH, db: Session = Depends(get_db)):
|
||||||
|
"""根据多种条件查询账号"""
|
||||||
|
accounts = AccountService.search_accounts(
|
||||||
|
db,
|
||||||
|
project_name=request.project_name,
|
||||||
|
yh_id=request.yh_id
|
||||||
|
)
|
||||||
|
if not accounts:
|
||||||
|
return AccountListResponse(
|
||||||
|
code=ResponseCode.ACCOUNT_NOT_FOUND,
|
||||||
|
message=ResponseMessage.ACCOUNT_NOT_FOUND,
|
||||||
|
total=0,
|
||||||
|
data=[]
|
||||||
|
)
|
||||||
|
return AccountListResponse(
|
||||||
|
code=ResponseCode.SUCCESS,
|
||||||
|
message="查询成功",
|
||||||
|
total=len(accounts),
|
||||||
|
data=accounts
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/update", response_model=AccountApiResponse)
|
@router.post("/update", response_model=AccountApiResponse)
|
||||||
def update_account(request: AccountUpdateRequest, db: Session = Depends(get_db)):
|
def update_account(request: AccountUpdateRequest, db: Session = Depends(get_db)):
|
||||||
"""更新账号"""
|
"""更新账号"""
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ class AccountGetRequest(BaseModel):
|
|||||||
yh_id: Optional[str] = None
|
yh_id: Optional[str] = None
|
||||||
cl_name: Optional[str] = None
|
cl_name: Optional[str] = None
|
||||||
|
|
||||||
|
# 宇恒一号特定查询模型
|
||||||
|
class AccountGetRequestYH(BaseModel):
|
||||||
|
project_name: Optional[str] = None
|
||||||
|
yh_id: str
|
||||||
|
|
||||||
class AccountUpdateRequest(BaseModel):
|
class AccountUpdateRequest(BaseModel):
|
||||||
account_id: int
|
account_id: int
|
||||||
account_data: AccountUpdate
|
account_data: AccountUpdate
|
||||||
|
|||||||
Reference in New Issue
Block a user