diff --git a/README.md b/README.md index e3935dc1..da785887 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Kinit 是一套全部开源的快速开发平台,毫无保留给个人及企

- logo + logo

@@ -57,6 +57,7 @@ Kinit 是一套全部开源的快速开发平台,毫无保留给个人及企 + ## 在线体验 PC端演示地址:https://kinit.ktianc.top diff --git a/kinit-api/application/settings.py b/kinit-api/application/settings.py index 349dd83e..8b3732a9 100644 --- a/kinit-api/application/settings.py +++ b/kinit-api/application/settings.py @@ -11,7 +11,7 @@ """ 系统版本 """ -VERSION = "3.8.0" +VERSION = "3.8.1" """安全警告: 不要在生产中打开调试运行!""" DEBUG = False diff --git a/kinit-api/apps/vadmin/workplace/views.py b/kinit-api/apps/vadmin/workplace/views.py index a5726f73..cb778226 100644 --- a/kinit-api/apps/vadmin/workplace/views.py +++ b/kinit-api/apps/vadmin/workplace/views.py @@ -123,6 +123,14 @@ async def get_team(): @app.get("/shortcuts", summary="获取快捷操作") async def get_shortcuts(): data = [ + { + "name": "Gitee 项目仓库", + "link": "https://gitee.com/ktianc/kinit" + }, + { + "name": "GitHub 项目仓库", + "link": "https://github.com/vvandk/kinit" + }, { "name": "前端文档", "link": "https://element-plus-admin-doc.cn/" @@ -136,8 +144,8 @@ async def get_shortcuts(): "link": "http://kinit.ktianc.top/api/redoc" }, { - "name": "Windi CSS 文档", - "link": "https://cn.windicss.org/guide/" + "name": "UnoCSS 中文文档", + "link": "https://unocss.nodejs.cn/guide/" }, { "name": "Iconify 文档", diff --git a/kinit-api/utils/file/aliyun_oss.py b/kinit-api/utils/file/aliyun_oss.py index 910cabea..e5616533 100644 --- a/kinit-api/utils/file/aliyun_oss.py +++ b/kinit-api/utils/file/aliyun_oss.py @@ -58,7 +58,7 @@ async def upload_image(self, path: str, file: UploadFile, max_size: int = 10) -> # 验证图片类型 await self.validate_file(file, max_size, self.IMAGE_ACCEPT) # 生成文件路径 - path = self.generate_static_file_path(path, file.filename) + path = self.generate_relative_path(path, file.filename) file_data = await file.read() return await self.__upload_file_to_oss(path, file_data) @@ -74,7 +74,7 @@ async def upload_video(self, path: str, file: UploadFile, max_size: int = 100) - # 验证图片类型 await self.validate_file(file, max_size, self.VIDEO_ACCEPT) # 生成文件路径 - path = self.generate_static_file_path(path, file.filename) + path = self.generate_relative_path(path, file.filename) file_data = await file.read() return await self.__upload_file_to_oss(path, file_data) @@ -86,7 +86,7 @@ async def upload_file(self, path: str, file: UploadFile) -> str: :param file: 文件对象 :return: 上传后的文件oss链接 """ - path = self.generate_static_file_path(path, file.filename) + path = self.generate_relative_path(path, file.filename) file_data = await file.read() return await self.__upload_file_to_oss(path, file_data) diff --git a/kinit-api/utils/file/file_base.py b/kinit-api/utils/file/file_base.py index f229d383..9d5a2500 100644 --- a/kinit-api/utils/file/file_base.py +++ b/kinit-api/utils/file/file_base.py @@ -44,15 +44,14 @@ def get_today_timestamp(cls) -> str: return str(int((datetime.datetime.now().replace(hour=0, minute=0, second=0)).timestamp())) @classmethod - def generate_static_file_path(cls, path: str, filename: str = None, suffix: str = None) -> str: + def generate_relative_path(cls, path: str, filename: str = None, suffix: str = None) -> str: """ - 生成 static 静态文件路径,生成规则:自定义目录/当天日期时间戳/随机文件名称 + 生成相对路径,生成规则:自定义目录/当天日期时间戳/随机文件名称 1. filename 参数或者 suffix 参数必须填写一个 2. filename 参数和 suffix 参数都存在则优先取 suffix 参数为后缀 :param path: static 指定目录类别 :param filename: 文件名称,只用户获取后缀,不做真实文件名称,避免文件重复问题 :param suffix: 文件后缀 - :return: """ if not filename and not suffix: raise ValueError("filename 参数或者 suffix 参数必须填写一个") @@ -64,7 +63,20 @@ def generate_static_file_path(cls, path: str, filename: str = None, suffix: str if path[-1] == "/": path = path[:-1] today = datetime.datetime.strftime(datetime.datetime.now(), "%Y%m%d") - return f"{STATIC_ROOT}/{path}/{today}/{cls.get_random_filename(suffix)}" + return f"{path}/{today}/{cls.get_random_filename(suffix)}" + + @classmethod + def generate_static_file_path(cls, path: str, filename: str = None, suffix: str = None) -> str: + """ + 生成 static 静态文件路径,生成规则:自定义目录/当天日期时间戳/随机文件名称 + 1. filename 参数或者 suffix 参数必须填写一个 + 2. filename 参数和 suffix 参数都存在则优先取 suffix 参数为后缀 + :param path: static 指定目录类别 + :param filename: 文件名称,只用户获取后缀,不做真实文件名称,避免文件重复问题 + :param suffix: 文件后缀 + :return: + """ + return f"{STATIC_ROOT}/{cls.generate_relative_path(path, filename, suffix)}" @classmethod def generate_temp_file_path(cls, filename: str = None, suffix: str = None) -> str: