|
@@ -52,6 +52,7 @@ from app.schemas.wechat import WechatIn
|
|
|
from app.schemas.resource import FileUploadOut
|
|
from app.schemas.resource import FileUploadOut
|
|
|
from app.schemas.statistics import VasStatisticsOverviewOut
|
|
from app.schemas.statistics import VasStatisticsOverviewOut
|
|
|
from app.schemas.llm import ParseUserInputsPayload, ParseUserInputsOut
|
|
from app.schemas.llm import ParseUserInputsPayload, ParseUserInputsOut
|
|
|
|
|
+from app.schemas.account import AccountResponse, AccountCreate, LockRequest
|
|
|
from app.schemas.docker_remote import RemoteServerConfig, DockerStatusOut, DockerLogsRequest, DockerLogsOut, ConfigReadOut, ConfigReadRequest, ConfigUpdateRequest, LogReadRequest, LogReadOut, LogListOut, DockerContainerStatus, DockerActionRequest, ServerConfigItem, ServerListOut, RemoteActionRequest
|
|
from app.schemas.docker_remote import RemoteServerConfig, DockerStatusOut, DockerLogsRequest, DockerLogsOut, ConfigReadOut, ConfigReadRequest, ConfigUpdateRequest, LogReadRequest, LogReadOut, LogListOut, DockerContainerStatus, DockerActionRequest, ServerConfigItem, ServerListOut, RemoteActionRequest
|
|
|
from app.services.docker_remote_service import DockerRemoteService
|
|
from app.services.docker_remote_service import DockerRemoteService
|
|
|
from app.services.configuration_service import ConfigurationService
|
|
from app.services.configuration_service import ConfigurationService
|
|
@@ -83,6 +84,7 @@ from app.services.slot_snapshot_service import SlotSnapshotService
|
|
|
from app.services.statistics_service import StatisticsService
|
|
from app.services.statistics_service import StatisticsService
|
|
|
from app.services.llm_service import LlmService
|
|
from app.services.llm_service import LlmService
|
|
|
from app.services.slot_refresh_status_service import SlotRefreshStatusService
|
|
from app.services.slot_refresh_status_service import SlotRefreshStatusService
|
|
|
|
|
+from app.services.account_service import AccountService
|
|
|
|
|
|
|
|
# 公共路由
|
|
# 公共路由
|
|
|
public_router = APIRouter()
|
|
public_router = APIRouter()
|
|
@@ -558,6 +560,39 @@ async def email_authorizations_send_email_bulk(
|
|
|
)
|
|
)
|
|
|
return success(data={"body": result})
|
|
return success(data={"body": result})
|
|
|
|
|
|
|
|
|
|
+@admin_required_router.get("/account/next", summary="获取下一个账号", tags=["账号管理"], response_model=ApiResponse[AccountResponse])
|
|
|
|
|
+async def account_next(
|
|
|
|
|
+ pool_name: str,
|
|
|
|
|
+ lock_duration: float = 60.0,
|
|
|
|
|
+ db: AsyncSession = Depends(get_db)
|
|
|
|
|
+):
|
|
|
|
|
+ account = await AccountService.get_next_account(db, pool_name, lock_duration)
|
|
|
|
|
+ return success(data=account)
|
|
|
|
|
+
|
|
|
|
|
+@admin_required_router.post("/account/add", summary="新增一个账号", tags=["账号管理"], response_model=ApiResponse[AccountResponse])
|
|
|
|
|
+async def account_add(
|
|
|
|
|
+ payload: AccountCreate,
|
|
|
|
|
+ db: AsyncSession = Depends(get_db)
|
|
|
|
|
+):
|
|
|
|
|
+ account = await AccountService.add_account(db, payload)
|
|
|
|
|
+ return success(data=account)
|
|
|
|
|
+
|
|
|
|
|
+@admin_required_router.post("/account/lock", summary="锁定账号", tags=["账号管理"], response_model=ApiResponse)
|
|
|
|
|
+async def account_lock(
|
|
|
|
|
+ payload: LockRequest,
|
|
|
|
|
+ db: AsyncSession = Depends(get_db)
|
|
|
|
|
+):
|
|
|
|
|
+ await AccountManager.manual_lock(db, payload)
|
|
|
|
|
+ return success()
|
|
|
|
|
+
|
|
|
|
|
+@admin_required_router.post("/account/disable", summary="禁用账号", tags=["账号管理"], response_model=ApiResponse)
|
|
|
|
|
+async def account_disable(
|
|
|
|
|
+ payload: LockRequest,
|
|
|
|
|
+ db: AsyncSession = Depends(get_db)
|
|
|
|
|
+):
|
|
|
|
|
+ await AccountManager.disable_account(db, payload)
|
|
|
|
|
+ return success()
|
|
|
|
|
+
|
|
|
@public_router.post("/resource/upload_file", summary="上传文件", tags=["文件管理"], response_model=ApiResponse[FileUploadOut])
|
|
@public_router.post("/resource/upload_file", summary="上传文件", tags=["文件管理"], response_model=ApiResponse[FileUploadOut])
|
|
|
async def resource_upload_file(file: UploadFile = File(...)):
|
|
async def resource_upload_file(file: UploadFile = File(...)):
|
|
|
result = await SeaweedFSService.upload(file)
|
|
result = await SeaweedFSService.upload(file)
|