优化后的遗留问题修复
This commit is contained in:
parent
0ec1876584
commit
1396520ea3
@ -11,7 +11,7 @@ from fastapi.security import OAuth2PasswordBearer
|
||||
"""
|
||||
系统版本
|
||||
"""
|
||||
VERSION = "3.4.0"
|
||||
VERSION = "3.4.1"
|
||||
|
||||
"""安全警告: 不要在生产中打开调试运行!"""
|
||||
DEBUG = False
|
||||
|
@ -108,7 +108,7 @@ class SettingsDal(DalBase):
|
||||
if ico.config_value == web_ico:
|
||||
continue
|
||||
# 将上传的ico路径替换到static/system/favicon.ico文件
|
||||
await FileManage.async_copy(value, os.path.join(STATIC_ROOT, "system/favicon.ico"))
|
||||
await FileManage.async_copy_file(value, os.path.join(STATIC_ROOT, "system/favicon.ico"))
|
||||
sql = update(self.model).where(self.model.config_key == "web_ico").values(config_value=web_ico)
|
||||
await self.db.execute(sql)
|
||||
else:
|
||||
|
@ -37,7 +37,7 @@ class MongoManage:
|
||||
:param is_object_id: _id 列是否为 ObjectId 格式
|
||||
"""
|
||||
self.db = db
|
||||
self.collection = db[collection]
|
||||
self.collection = db[collection] if collection else None
|
||||
self.schema = schema
|
||||
self.is_object_id = is_object_id
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
# @desc : 缓存
|
||||
|
||||
from typing import List
|
||||
|
||||
from sqlalchemy import false
|
||||
from sqlalchemy.future import select
|
||||
from sqlalchemy.orm import joinedload
|
||||
from core.logger import logger # 注意:报错就在这里,如果只写 core.logger 会写入日志报错,很难排查
|
||||
@ -34,9 +36,9 @@ class Cache:
|
||||
model = VadminSystemSettingsTab
|
||||
v_options = [joinedload(model.settings)]
|
||||
sql = select(model).where(
|
||||
model.is_delete == False,
|
||||
model.is_delete == false(),
|
||||
model.tab_name.in_(tab_names),
|
||||
model.disabled == False
|
||||
model.disabled == false()
|
||||
).options(*[load for load in v_options])
|
||||
queryset = await session.execute(sql)
|
||||
datas = queryset.scalars().unique().all()
|
||||
@ -74,7 +76,7 @@ class Cache:
|
||||
"""
|
||||
获取系统配置
|
||||
:param tab_name: 配置表标签名称
|
||||
:param retry_num: 重试次数
|
||||
:param retry: 重试次数
|
||||
"""
|
||||
result = await self.rd.get(tab_name)
|
||||
if not result and retry > 0:
|
||||
|
@ -60,10 +60,10 @@ class AliyunOSS(FileBase):
|
||||
# 验证图片类型
|
||||
await self.validate_file(file, max_size, self.IMAGE_ACCEPT)
|
||||
# 生成文件路径
|
||||
path = self.generate_path(path, file.filename)
|
||||
path = self.generate_static_file_path(path, file.filename)
|
||||
if compress:
|
||||
# 压缩图片
|
||||
file_path = await FileManage.save_tmp_file(file)
|
||||
file_path = await FileManage.async_save_temp_file(file)
|
||||
new_file = compress_jpg_png(file_path, originpath=os.path.abspath(file_path))
|
||||
with open(new_file, "rb") as f:
|
||||
file_data = f.read()
|
||||
@ -83,7 +83,7 @@ class AliyunOSS(FileBase):
|
||||
# 验证图片类型
|
||||
await self.validate_file(file, max_size, self.VIDEO_ACCEPT)
|
||||
# 生成文件路径
|
||||
path = self.generate_path(path, file.filename)
|
||||
path = self.generate_static_file_path(path, file.filename)
|
||||
file_data = await file.read()
|
||||
return await self.__upload_file_to_oss(path, file_data)
|
||||
|
||||
@ -95,7 +95,7 @@ class AliyunOSS(FileBase):
|
||||
:param file: 文件对象
|
||||
:return: 上传后的文件oss链接
|
||||
"""
|
||||
path = self.generate_path(path, file.filename)
|
||||
path = self.generate_static_file_path(path, file.filename)
|
||||
file_data = await file.read()
|
||||
return await self.__upload_file_to_oss(path, file_data)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user