完成项目信息管理的迁移
This commit is contained in:
@ -12,6 +12,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from application.settings import ALIYUN_OSS
|
||||
from core.database import db_getter, redis_getter, mongo_getter
|
||||
from utils.file.aliyun_oss import AliyunOSS, BucketConf
|
||||
from utils.huawei_obs import ObsClient
|
||||
from utils.file.file_manage import FileManage
|
||||
from utils.response import SuccessResponse, ErrorResponse
|
||||
from utils.sms.code import CodeSMS
|
||||
@ -102,34 +103,6 @@ async def get_dict_detail(data_id: int, auth: Auth = Depends(AllUserAuth())):
|
||||
return SuccessResponse(await crud.DictDetailsDal(auth.db).get_data(data_id, v_schema=schema))
|
||||
|
||||
|
||||
###########################################################
|
||||
# 文件上传管理
|
||||
###########################################################
|
||||
@app.post("/upload/image/to/oss", summary="上传图片到阿里云OSS")
|
||||
async def upload_image_to_oss(file: UploadFile, path: str = Form(...)):
|
||||
result = await AliyunOSS(BucketConf(**ALIYUN_OSS)).upload_image(path, file)
|
||||
return SuccessResponse(result)
|
||||
|
||||
|
||||
@app.post("/upload/video/to/oss", summary="上传视频到阿里云OSS")
|
||||
async def upload_video_to_oss(file: UploadFile, path: str = Form(...)):
|
||||
result = await AliyunOSS(BucketConf(**ALIYUN_OSS)).upload_video(path, file)
|
||||
return SuccessResponse(result)
|
||||
|
||||
|
||||
@app.post("/upload/file/to/oss", summary="上传文件到阿里云OSS")
|
||||
async def upload_file_to_oss(file: UploadFile, path: str = Form(...)):
|
||||
result = await AliyunOSS(BucketConf(**ALIYUN_OSS)).upload_file(path, file)
|
||||
return SuccessResponse(result)
|
||||
|
||||
|
||||
@app.post("/upload/image/to/local", summary="上传图片到本地")
|
||||
async def upload_image_to_local(file: UploadFile, path: str = Form(...)):
|
||||
manage = FileManage(file, path)
|
||||
path = await manage.save_image_local()
|
||||
return SuccessResponse(path)
|
||||
|
||||
|
||||
###########################################################
|
||||
# 短信服务管理
|
||||
###########################################################
|
||||
@ -142,43 +115,6 @@ async def sms_send(telephone: str, rd: Redis = Depends(redis_getter), auth: Auth
|
||||
return SuccessResponse(await sms.main_async())
|
||||
|
||||
|
||||
###########################################################
|
||||
# 系统配置管理
|
||||
###########################################################
|
||||
@app.post("/settings/tabs", summary="获取系统配置标签列表")
|
||||
async def get_settings_tabs(classifys: list[str] = Body(...), auth: Auth = Depends(FullAdminAuth())):
|
||||
return SuccessResponse(await crud.SettingsTabDal(auth.db).get_datas(limit=0, classify=("in", classifys)))
|
||||
|
||||
|
||||
@app.get("/settings/tabs/values", summary="获取系统配置标签下的信息")
|
||||
async def get_settings_tabs_values(tab_id: int, auth: Auth = Depends(FullAdminAuth())):
|
||||
return SuccessResponse(await crud.SettingsDal(auth.db).get_tab_values(tab_id=tab_id))
|
||||
|
||||
|
||||
@app.put("/settings/tabs/values", summary="更新系统配置信息")
|
||||
async def put_settings_tabs_values(
|
||||
request: Request,
|
||||
datas: dict = Body(...),
|
||||
auth: Auth = Depends(FullAdminAuth())
|
||||
):
|
||||
return SuccessResponse(await crud.SettingsDal(auth.db).update_datas(datas, request))
|
||||
|
||||
|
||||
@app.get("/settings/base/config", summary="获取系统基础配置", description="每次进入系统中时使用")
|
||||
async def get_setting_base_config(db: AsyncSession = Depends(db_getter)):
|
||||
return SuccessResponse(await crud.SettingsDal(db).get_base_config())
|
||||
|
||||
|
||||
@app.get("/settings/privacy", summary="获取隐私协议")
|
||||
async def get_settings_privacy(auth: Auth = Depends(OpenAuth())):
|
||||
return SuccessResponse((await crud.SettingsDal(auth.db).get_data(config_key="web_privacy")).config_value)
|
||||
|
||||
|
||||
@app.get("/settings/agreement", summary="获取用户协议")
|
||||
async def get_settings_agreement(auth: Auth = Depends(OpenAuth())):
|
||||
return SuccessResponse((await crud.SettingsDal(auth.db).get_data(config_key="web_agreement")).config_value)
|
||||
|
||||
|
||||
###########################################################
|
||||
# 定时任务管理
|
||||
###########################################################
|
||||
|
Reference in New Issue
Block a user