From 07771c180d5b977edd324cbf8b53dd89a170fb04 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Sat, 27 Jul 2024 16:31:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D1.3.0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E9=87=87=E7=94=A8=E6=96=B0=E7=9A=84=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=9C=BA=E5=88=B6=E5=90=8E=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=A3=85=E9=A5=B0=E5=99=A8=E6=97=A0=E6=B3=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=97=A5=E5=BF=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_admin/annotation/log_annotation.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py b/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py index 4d0737e..1f3e220 100644 --- a/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py +++ b/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py @@ -15,6 +15,8 @@ from module_admin.service.log_service import LoginLogService, OperationLogServic from module_admin.service.login_service import LoginService from config.enums import BusinessType from config.env import AppConfig +from exceptions.exception import LoginException, ServiceException, ServiceWarning +from utils.response_util import ResponseUtil class Log: @@ -111,8 +113,17 @@ class Log: loginTime=oper_time.strftime('%Y-%m-%d %H:%M:%S'), ) kwargs['form_data'].login_info = login_log - # 调用原始函数 - result = await func(*args, **kwargs) + try: + # 调用原始函数 + result = await func(*args, **kwargs) + except LoginException as e: + result = ResponseUtil.failure(data=e.data, msg=e.message) + except ServiceException as e: + result = ResponseUtil.error(data=e.data, msg=e.message) + except ServiceWarning as e: + result = ResponseUtil.failure(data=e.data, msg=e.message) + except Exception as e: + result = ResponseUtil.error(msg=str(e)) # 获取请求耗时 cost_time = float(time.time() - start_time) * 100 # 判断请求是否来自api文档 @@ -281,8 +292,17 @@ def log_decorator( loginTime=oper_time.strftime('%Y-%m-%d %H:%M:%S'), ) kwargs['form_data'].login_info = login_log - # 调用原始函数 - result = await func(*args, **kwargs) + try: + # 调用原始函数 + result = await func(*args, **kwargs) + except LoginException as e: + result = ResponseUtil.failure(data=e.data, msg=e.message) + except ServiceException as e: + result = ResponseUtil.error(data=e.data, msg=e.message) + except ServiceWarning as e: + result = ResponseUtil.failure(data=e.data, msg=e.message) + except Exception as e: + result = ResponseUtil.error(msg=str(e)) # 获取请求耗时 cost_time = float(time.time() - start_time) * 100 # 判断请求是否来自api文档 From a1c77829cdfc41e9aeb59d30a460a666b7b846c9 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Wed, 31 Jul 2024 10:59:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?perf:=20=E8=A1=A5=E5=85=85=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E8=BF=9D=E8=A7=84=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-fastapi-backend/config/constant.py | 37 +++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/ruoyi-fastapi-backend/config/constant.py b/ruoyi-fastapi-backend/config/constant.py index 9129fe0..6db32da 100644 --- a/ruoyi-fastapi-backend/config/constant.py +++ b/ruoyi-fastapi-backend/config/constant.py @@ -76,7 +76,7 @@ class JobConstant: """ 定时任务常量 - JOB_ERROR_LIST: 定时任务禁止调用模块列表 + JOB_ERROR_LIST: 定时任务禁止调用模块及违规字符串列表 JOB_WHITE_LIST: 定时任务允许调用模块列表 """ @@ -84,11 +84,46 @@ class JobConstant: 'app', 'config', 'exceptions', + 'import ', 'middlewares', 'module_admin', + 'open(', + 'os.', 'server', 'sub_applications', + 'subprocess.', + 'sys.', 'utils', + 'while ', + '__import__', + '"', + "'", + ',', + '?', + ':', + ';', + '/', + '|', + '+', + '-', + '=', + '~', + '!', + '#', + '$', + '%', + '^', + '&', + '*', + '<', + '>', + '(', + ')', + '[', + ']', + '{', + '}', + ' ', ] JOB_WHITE_LIST = ['module_task'] From 1f51525dfa177f9dc1e0c04509dee0ea97785640 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Wed, 31 Jul 2024 11:13:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20=E5=8D=87=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=87=B31.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-fastapi-backend/.env.dev | 2 +- ruoyi-fastapi-backend/.env.prod | 2 +- ruoyi-fastapi-frontend/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-fastapi-backend/.env.dev b/ruoyi-fastapi-backend/.env.dev index 344c027..3ca3eb2 100644 --- a/ruoyi-fastapi-backend/.env.dev +++ b/ruoyi-fastapi-backend/.env.dev @@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 9099 # 应用版本 -APP_VERSION= '1.3.0' +APP_VERSION= '1.3.1' # 应用是否开启热重载 APP_RELOAD = true # 应用是否开启IP归属区域查询 diff --git a/ruoyi-fastapi-backend/.env.prod b/ruoyi-fastapi-backend/.env.prod index b2d2d57..5a681c5 100644 --- a/ruoyi-fastapi-backend/.env.prod +++ b/ruoyi-fastapi-backend/.env.prod @@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 9099 # 应用版本 -APP_VERSION= '1.3.0' +APP_VERSION= '1.3.1' # 应用是否开启热重载 APP_RELOAD = false # 应用是否开启IP归属区域查询 diff --git a/ruoyi-fastapi-frontend/package.json b/ruoyi-fastapi-frontend/package.json index 74fb2fa..9cd358d 100644 --- a/ruoyi-fastapi-frontend/package.json +++ b/ruoyi-fastapi-frontend/package.json @@ -1,6 +1,6 @@ { "name": "vfadmin", - "version": "1.3.0", + "version": "1.3.1", "description": "vfadmin管理系统", "author": "insistence", "license": "MIT", From e52f0f42cb1a02fbeb19c89e03489167130705e5 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Wed, 31 Jul 2024 11:14:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0README=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 02641ca..24409e9 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,17 @@
-