Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
42009cf3f4 | ||
![]() |
f4afa20ac2 | ||
![]() |
7fd3109b52 | ||
![]() |
dfb8af23b3 | ||
![]() |
b423647ad5 | ||
![]() |
423491302d | ||
![]() |
fa27fd3b68 | ||
![]() |
88b27685c1 | ||
![]() |
2bade4d6c9 | ||
![]() |
a06c9f17d6 | ||
![]() |
3654f4d88b | ||
![]() |
38aca38d4d | ||
![]() |
a57d737261 | ||
![]() |
84f56da523 | ||
![]() |
f73a00e73c | ||
![]() |
a84ad47de4 | ||
![]() |
303612eed9 | ||
![]() |
dcb1f4d13c | ||
![]() |
44ddc8c3a8 | ||
![]() |
70f6f8a471 | ||
![]() |
2a45df71cd | ||
![]() |
eabeb705c4 | ||
![]() |
e9ad084dff | ||
![]() |
2e6c648126 | ||
![]() |
153982436d | ||
![]() |
45c3fa18e0 | ||
![]() |
3361fca5d2 | ||
![]() |
b65aa4eea7 | ||
![]() |
7c4f0d1cb3 | ||
![]() |
00520bc227 | ||
![]() |
bb94d38d53 | ||
![]() |
3ac12cab8c | ||
![]() |
4ea6fa7817 | ||
![]() |
fa065dfe45 | ||
![]() |
0a3102bdcf | ||
![]() |
b109d5abe3 | ||
![]() |
d828433a79 | ||
![]() |
d60d6ae8e5 | ||
![]() |
6a285068cf | ||
![]() |
e70e9c2dcd | ||
![]() |
76ea949d32 | ||
![]() |
6e2d62a73d |
11
README.md
11
README.md
@@ -1,20 +1,25 @@
|
||||
<p align="center">
|
||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
||||
</p>
|
||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi-Vue3-FastAPI v1.0.0</h1>
|
||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi-Vue3-FastAPI v1.1.1</h1>
|
||||
<h4 align="center">基于RuoYi-Vue3+FastAPI前后端分离的快速开发框架</h4>
|
||||
<p align="center">
|
||||
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/stargazers"><img src="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/badge/star.svg?theme=dark"></a>
|
||||
<a href="https://github.com/insistence/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/github/stars/insistence/RuoYi-Vue3-FastAPI?style=social"></a>
|
||||
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/badge/RuoYiVue3FastAPI-v1.0.0-brightgreen.svg"></a>
|
||||
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/badge/RuoYiVue3FastAPI-v1.1.1-brightgreen.svg"></a>
|
||||
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||
<img src="https://img.shields.io/badge/python-≥3.8-blue">
|
||||
<img src="https://img.shields.io/badge/MySQL-≥5.7-blue">
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## 平台简介
|
||||
|
||||
RuoYi-Vue-FastAPI是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||
RuoYi-Vue3-FastAPI是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||
|
||||
* 前端采用Vue、Element Plus,基于<u>[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3)</u>前端项目修改。
|
||||
* 后端采用FastAPI、sqlalchemy、MySQL、Redis、OAuth2 & Jwt。
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# 应用运行环境
|
||||
APP_ENV = 'dev'
|
||||
# 应用名称
|
||||
APP_NAME = 'RuoYi-FasAPI'
|
||||
APP_NAME = 'RuoYi-FastAPI'
|
||||
# 应用代理路径
|
||||
APP_ROOT_PATH = '/dev-api'
|
||||
# 应用主机
|
||||
@@ -10,9 +10,13 @@ APP_HOST = '0.0.0.0'
|
||||
# 应用端口
|
||||
APP_PORT = 9099
|
||||
# 应用版本
|
||||
APP_VERSION= '1.0.0'
|
||||
APP_VERSION= '1.1.1'
|
||||
# 应用是否开启热重载
|
||||
APP_RELOAD = true
|
||||
# 应用是否开启IP归属区域查询
|
||||
APP_IP_LOCATION_QUERY = true
|
||||
# 应用是否允许账号同时登录
|
||||
APP_SAME_TIME_LOGIN = true
|
||||
|
||||
# -------- Jwt配置 --------
|
||||
# Jwt秘钥
|
||||
@@ -36,6 +40,8 @@ DB_USERNAME = 'root'
|
||||
DB_PASSWORD = 'mysqlroot'
|
||||
# 数据库名称
|
||||
DB_DATABASE = 'ruoyi-fastapi'
|
||||
# 是否开启sqlalchemy日志
|
||||
DB_ECHO = true
|
||||
|
||||
# -------- Redis配置 --------
|
||||
# Redis主机
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# 应用运行环境
|
||||
APP_ENV = 'prod'
|
||||
# 应用名称
|
||||
APP_NAME = 'RuoYi-FasAPI'
|
||||
APP_NAME = 'RuoYi-FastAPI'
|
||||
# 应用代理路径
|
||||
APP_ROOT_PATH = '/prod-api'
|
||||
# 应用主机
|
||||
@@ -10,9 +10,13 @@ APP_HOST = '0.0.0.0'
|
||||
# 应用端口
|
||||
APP_PORT = 9099
|
||||
# 应用版本
|
||||
APP_VERSION= '1.0.0'
|
||||
APP_VERSION= '1.1.1'
|
||||
# 应用是否开启热重载
|
||||
APP_RELOAD = false
|
||||
# 应用是否开启IP归属区域查询
|
||||
APP_IP_LOCATION_QUERY = true
|
||||
# 应用是否允许账号同时登录
|
||||
APP_SAMETIME_LOGIN = true
|
||||
|
||||
# -------- Jwt配置 --------
|
||||
# Jwt秘钥
|
||||
@@ -36,6 +40,8 @@ DB_USERNAME = 'root'
|
||||
DB_PASSWORD = 'root'
|
||||
# 数据库名称
|
||||
DB_DATABASE = 'ruoyi-fastapi'
|
||||
# 是否开启sqlalchemy日志
|
||||
DB_ECHO = true
|
||||
|
||||
# -------- Redis配置 --------
|
||||
# Redis主机
|
||||
|
@@ -8,7 +8,7 @@ SQLALCHEMY_DATABASE_URL = f"mysql+pymysql://{DataBaseConfig.db_username}:{quote_
|
||||
f"{DataBaseConfig.db_host}:{DataBaseConfig.db_port}/{DataBaseConfig.db_database}"
|
||||
|
||||
engine = create_engine(
|
||||
SQLALCHEMY_DATABASE_URL, echo=True
|
||||
SQLALCHEMY_DATABASE_URL, echo=DataBaseConfig.db_echo
|
||||
)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
Base = declarative_base()
|
||||
|
@@ -17,6 +17,8 @@ class AppSettings(BaseSettings):
|
||||
app_port: int = 9099
|
||||
app_version: str = '1.0.0'
|
||||
app_reload: bool = True
|
||||
app_ip_location_query: bool = True
|
||||
app_same_time_login: bool = True
|
||||
|
||||
|
||||
class JwtSettings(BaseSettings):
|
||||
@@ -38,6 +40,7 @@ class DataBaseSettings(BaseSettings):
|
||||
db_username: str = 'root'
|
||||
db_password: str = 'mysqlroot'
|
||||
db_database: str = 'ruoyi-fastapi'
|
||||
db_echo: bool = True
|
||||
|
||||
|
||||
class RedisSettings(BaseSettings):
|
||||
|
@@ -12,6 +12,7 @@ from typing import Optional
|
||||
from module_admin.service.login_service import LoginService
|
||||
from module_admin.service.log_service import OperationLogService, LoginLogService
|
||||
from module_admin.entity.vo.log_vo import OperLogModel, LogininforModel
|
||||
from config.env import AppConfig
|
||||
|
||||
|
||||
def log_decorator(title: str, business_type: int, log_type: Optional[str] = 'operation'):
|
||||
@@ -50,122 +51,126 @@ def log_decorator(title: str, business_type: int, log_type: Optional[str] = 'ope
|
||||
# 获取请求的ip及ip归属区域
|
||||
oper_ip = request.headers.get("X-Forwarded-For")
|
||||
oper_location = '内网IP'
|
||||
try:
|
||||
if oper_ip != '127.0.0.1' and oper_ip != 'localhost':
|
||||
ip_result = requests.get(f'https://qifu-api.baidubce.com/ip/geo/v1/district?ip={oper_ip}')
|
||||
if ip_result.status_code == 200:
|
||||
prov = ip_result.json().get('data').get('prov')
|
||||
city = ip_result.json().get('data').get('city')
|
||||
if prov or city:
|
||||
oper_location = f'{prov}-{city}'
|
||||
if AppConfig.app_ip_location_query:
|
||||
try:
|
||||
if oper_ip != '127.0.0.1' and oper_ip != 'localhost':
|
||||
ip_result = requests.get(f'https://qifu-api.baidubce.com/ip/geo/v1/district?ip={oper_ip}')
|
||||
if ip_result.status_code == 200:
|
||||
prov = ip_result.json().get('data').get('prov')
|
||||
city = ip_result.json().get('data').get('city')
|
||||
if prov or city:
|
||||
oper_location = f'{prov}-{city}'
|
||||
else:
|
||||
oper_location = '未知'
|
||||
else:
|
||||
oper_location = '未知'
|
||||
else:
|
||||
oper_location = '未知'
|
||||
except Exception as e:
|
||||
oper_location = '未知'
|
||||
print(e)
|
||||
finally:
|
||||
# 根据不同的请求类型使用不同的方法获取请求参数
|
||||
content_type = request.headers.get("Content-Type")
|
||||
if content_type and ("multipart/form-data" in content_type or 'application/x-www-form-urlencoded' in content_type):
|
||||
payload = await request.form()
|
||||
oper_param = "\n".join([f"{key}: {value}" for key, value in payload.items()])
|
||||
else:
|
||||
payload = await request.body()
|
||||
# 通过 request.path_params 直接访问路径参数
|
||||
path_params = request.path_params
|
||||
oper_param = {}
|
||||
if payload:
|
||||
oper_param.update(json.loads(str(payload, 'utf-8')))
|
||||
if path_params:
|
||||
oper_param.update(path_params)
|
||||
oper_param = json.dumps(oper_param, ensure_ascii=False)
|
||||
# 日志表请求参数字段长度最大为2000,因此在此处判断长度
|
||||
if len(oper_param) > 2000:
|
||||
oper_param = '请求参数过长'
|
||||
except Exception as e:
|
||||
oper_location = '未知'
|
||||
print(e)
|
||||
# 根据不同的请求类型使用不同的方法获取请求参数
|
||||
content_type = request.headers.get("Content-Type")
|
||||
if content_type and ("multipart/form-data" in content_type or 'application/x-www-form-urlencoded' in content_type):
|
||||
payload = await request.form()
|
||||
oper_param = "\n".join([f"{key}: {value}" for key, value in payload.items()])
|
||||
else:
|
||||
payload = await request.body()
|
||||
# 通过 request.path_params 直接访问路径参数
|
||||
path_params = request.path_params
|
||||
oper_param = {}
|
||||
if payload:
|
||||
oper_param.update(json.loads(str(payload, 'utf-8')))
|
||||
if path_params:
|
||||
oper_param.update(path_params)
|
||||
oper_param = json.dumps(oper_param, ensure_ascii=False)
|
||||
# 日志表请求参数字段长度最大为2000,因此在此处判断长度
|
||||
if len(oper_param) > 2000:
|
||||
oper_param = '请求参数过长'
|
||||
|
||||
# 获取操作时间
|
||||
oper_time = datetime.now()
|
||||
# 此处在登录之前向原始函数传递一些登录信息,用于监测在线用户的相关信息
|
||||
login_log = {}
|
||||
if log_type == 'login':
|
||||
user_agent_info = parse(user_agent)
|
||||
browser = f'{user_agent_info.browser.family} {user_agent_info.browser.version[0]}'
|
||||
system_os = f'{user_agent_info.os.family} {user_agent_info.os.version[0]}'
|
||||
login_log = dict(
|
||||
ipaddr=oper_ip,
|
||||
loginLocation=oper_location,
|
||||
browser=browser,
|
||||
os=system_os,
|
||||
loginTime=oper_time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
)
|
||||
kwargs['form_data'].login_info = login_log
|
||||
# 调用原始函数
|
||||
result = await func(*args, **kwargs)
|
||||
# 获取请求耗时
|
||||
cost_time = float(time.time() - start_time) * 100
|
||||
# 判断请求是否来自api文档
|
||||
request_from_swagger = request.headers.get('referer').endswith('docs') if request.headers.get('referer') else False
|
||||
request_from_redoc = request.headers.get('referer').endswith('redoc') if request.headers.get('referer') else False
|
||||
# 根据响应结果的类型使用不同的方法获取响应结果参数
|
||||
if isinstance(result, JSONResponse) or isinstance(result, ORJSONResponse) or isinstance(result, UJSONResponse):
|
||||
result_dict = json.loads(str(result.body, 'utf-8'))
|
||||
# 获取操作时间
|
||||
oper_time = datetime.now()
|
||||
# 此处在登录之前向原始函数传递一些登录信息,用于监测在线用户的相关信息
|
||||
login_log = {}
|
||||
if log_type == 'login':
|
||||
user_agent_info = parse(user_agent)
|
||||
browser = f'{user_agent_info.browser.family}'
|
||||
system_os = f'{user_agent_info.os.family}'
|
||||
if user_agent_info.browser.version != ():
|
||||
browser += f' {user_agent_info.browser.version[0]}'
|
||||
if user_agent_info.os.version != ():
|
||||
system_os += f' {user_agent_info.os.version[0]}'
|
||||
login_log = dict(
|
||||
ipaddr=oper_ip,
|
||||
loginLocation=oper_location,
|
||||
browser=browser,
|
||||
os=system_os,
|
||||
loginTime=oper_time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
)
|
||||
kwargs['form_data'].login_info = login_log
|
||||
# 调用原始函数
|
||||
result = await func(*args, **kwargs)
|
||||
# 获取请求耗时
|
||||
cost_time = float(time.time() - start_time) * 100
|
||||
# 判断请求是否来自api文档
|
||||
request_from_swagger = request.headers.get('referer').endswith('docs') if request.headers.get('referer') else False
|
||||
request_from_redoc = request.headers.get('referer').endswith('redoc') if request.headers.get('referer') else False
|
||||
# 根据响应结果的类型使用不同的方法获取响应结果参数
|
||||
if isinstance(result, JSONResponse) or isinstance(result, ORJSONResponse) or isinstance(result, UJSONResponse):
|
||||
result_dict = json.loads(str(result.body, 'utf-8'))
|
||||
else:
|
||||
if request_from_swagger or request_from_redoc:
|
||||
result_dict = {}
|
||||
else:
|
||||
if request_from_swagger or request_from_redoc:
|
||||
result_dict = {}
|
||||
if result.status_code == 200:
|
||||
result_dict = {'code': result.status_code, 'message': '获取成功'}
|
||||
else:
|
||||
if result.status_code == 200:
|
||||
result_dict = {'code': result.status_code, 'message': '获取成功'}
|
||||
else:
|
||||
result_dict = {'code': result.status_code, 'message': '获取失败'}
|
||||
json_result = json.dumps(result_dict, ensure_ascii=False)
|
||||
# 根据响应结果获取响应状态及异常信息
|
||||
status = 1
|
||||
error_msg = ''
|
||||
if result_dict.get('code') == 200:
|
||||
status = 0
|
||||
result_dict = {'code': result.status_code, 'message': '获取失败'}
|
||||
json_result = json.dumps(result_dict, ensure_ascii=False)
|
||||
# 根据响应结果获取响应状态及异常信息
|
||||
status = 1
|
||||
error_msg = ''
|
||||
if result_dict.get('code') == 200:
|
||||
status = 0
|
||||
else:
|
||||
error_msg = result_dict.get('msg')
|
||||
# 根据日志类型向对应的日志表插入数据
|
||||
if log_type == 'login':
|
||||
# 登录请求来自于api文档时不记录登录日志,其余情况则记录
|
||||
if request_from_swagger or request_from_redoc:
|
||||
pass
|
||||
else:
|
||||
error_msg = result_dict.get('msg')
|
||||
# 根据日志类型向对应的日志表插入数据
|
||||
if log_type == 'login':
|
||||
# 登录请求来自于api文档时不记录登录日志,其余情况则记录
|
||||
if request_from_swagger or request_from_redoc:
|
||||
pass
|
||||
else:
|
||||
user = kwargs.get('form_data')
|
||||
user_name = user.username
|
||||
login_log['loginTime'] = oper_time
|
||||
login_log['userName'] = user_name
|
||||
login_log['status'] = str(status)
|
||||
login_log['msg'] = result_dict.get('msg')
|
||||
user = kwargs.get('form_data')
|
||||
user_name = user.username
|
||||
login_log['loginTime'] = oper_time
|
||||
login_log['userName'] = user_name
|
||||
login_log['status'] = str(status)
|
||||
login_log['msg'] = result_dict.get('msg')
|
||||
|
||||
LoginLogService.add_login_log_services(query_db, LogininforModel(**login_log))
|
||||
else:
|
||||
current_user = await LoginService.get_current_user(request, token, query_db)
|
||||
oper_name = current_user.user.user_name
|
||||
dept_name = current_user.user.dept.dept_name if current_user.user.dept else None
|
||||
operation_log = OperLogModel(
|
||||
title=title,
|
||||
businessType=business_type,
|
||||
method=func_path,
|
||||
requestMethod=request_method,
|
||||
operatorType=operator_type,
|
||||
operName=oper_name,
|
||||
deptName=dept_name,
|
||||
operUrl=oper_url,
|
||||
operIp=oper_ip,
|
||||
operLocation=oper_location,
|
||||
operParam=oper_param,
|
||||
jsonResult=json_result,
|
||||
status=status,
|
||||
errorMsg=error_msg,
|
||||
operTime=oper_time,
|
||||
costTime=int(cost_time)
|
||||
)
|
||||
OperationLogService.add_operation_log_services(query_db, operation_log)
|
||||
LoginLogService.add_login_log_services(query_db, LogininforModel(**login_log))
|
||||
else:
|
||||
current_user = await LoginService.get_current_user(request, token, query_db)
|
||||
oper_name = current_user.user.user_name
|
||||
dept_name = current_user.user.dept.dept_name if current_user.user.dept else None
|
||||
operation_log = OperLogModel(
|
||||
title=title,
|
||||
businessType=business_type,
|
||||
method=func_path,
|
||||
requestMethod=request_method,
|
||||
operatorType=operator_type,
|
||||
operName=oper_name,
|
||||
deptName=dept_name,
|
||||
operUrl=oper_url,
|
||||
operIp=oper_ip,
|
||||
operLocation=oper_location,
|
||||
operParam=oper_param,
|
||||
jsonResult=json_result,
|
||||
status=status,
|
||||
errorMsg=error_msg,
|
||||
operTime=oper_time,
|
||||
costTime=int(cost_time)
|
||||
)
|
||||
OperationLogService.add_operation_log_services(query_db, operation_log)
|
||||
|
||||
return result
|
||||
return result
|
||||
|
||||
return wrapper
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from fastapi import Depends
|
||||
from typing import Union, List
|
||||
from module_admin.entity.vo.user_vo import CurrentUserModel
|
||||
from module_admin.service.login_service import LoginService
|
||||
from exceptions.exception import PermissionException
|
||||
@@ -7,13 +8,52 @@ from exceptions.exception import PermissionException
|
||||
class CheckUserInterfaceAuth:
|
||||
"""
|
||||
校验当前用户是否具有相应的接口权限
|
||||
:param perm: 权限标识
|
||||
:param is_strict: 当传入的权限标识是list类型时,是否开启严格模式,开启表示会校验列表中的每一个权限标识,所有的校验结果都需要为True才会通过
|
||||
"""
|
||||
def __init__(self, perm_str: str = 'common'):
|
||||
self.perm_str = perm_str
|
||||
def __init__(self, perm: Union[str, List], is_strict: bool = False):
|
||||
self.perm = perm
|
||||
self.is_strict = is_strict
|
||||
|
||||
def __call__(self, current_user: CurrentUserModel = Depends(LoginService.get_current_user)):
|
||||
user_auth_list = current_user.permissions
|
||||
user_auth_list.append('common')
|
||||
if '*:*:*' in user_auth_list or self.perm_str in user_auth_list:
|
||||
if '*:*:*' in user_auth_list:
|
||||
return True
|
||||
if isinstance(self.perm, str):
|
||||
if self.perm in user_auth_list:
|
||||
return True
|
||||
if isinstance(self.perm, list):
|
||||
if self.is_strict:
|
||||
if all([perm_str in user_auth_list for perm_str in self.perm]):
|
||||
return True
|
||||
else:
|
||||
if any([perm_str in user_auth_list for perm_str in self.perm]):
|
||||
return True
|
||||
raise PermissionException(data="", message="该用户无此接口权限")
|
||||
|
||||
|
||||
class CheckRoleInterfaceAuth:
|
||||
"""
|
||||
根据角色校验当前用户是否具有相应的接口权限
|
||||
:param role_key: 角色标识
|
||||
:param is_strict: 当传入的角色标识是list类型时,是否开启严格模式,开启表示会校验列表中的每一个角色标识,所有的校验结果都需要为True才会通过
|
||||
"""
|
||||
def __init__(self, role_key: Union[str, List], is_strict: bool = False):
|
||||
self.role_key = role_key
|
||||
self.is_strict = is_strict
|
||||
|
||||
def __call__(self, current_user: CurrentUserModel = Depends(LoginService.get_current_user)):
|
||||
user_role_list = current_user.user.role
|
||||
user_role_key_list = [role.role_key for role in user_role_list]
|
||||
if isinstance(self.role_key, str):
|
||||
if self.role_key in user_role_key_list:
|
||||
return True
|
||||
if isinstance(self.role_key, list):
|
||||
if self.is_strict:
|
||||
if all([role_key_str in user_role_key_list for role_key_str in self.role_key]):
|
||||
return True
|
||||
else:
|
||||
if any([role_key_str in user_role_key_list for role_key_str in self.role_key]):
|
||||
return True
|
||||
raise PermissionException(data="", message="该用户无此接口权限")
|
||||
|
||||
|
@@ -62,7 +62,7 @@ async def edit_system_config(request: Request, edit_config: ConfigModel, query_d
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@configController.delete("/refreshCache", dependencies=[Depends(CheckUserInterfaceAuth('system:config:edit'))])
|
||||
@configController.delete("/refreshCache", dependencies=[Depends(CheckUserInterfaceAuth('system:config:remove'))])
|
||||
@log_decorator(title='参数管理', business_type=2)
|
||||
async def refresh_system_config(request: Request, query_db: Session = Depends(get_db)):
|
||||
try:
|
||||
|
@@ -13,7 +13,7 @@ from module_admin.annotation.log_annotation import log_decorator
|
||||
deptController = APIRouter(prefix='/system/dept', dependencies=[Depends(LoginService.get_current_user)])
|
||||
|
||||
|
||||
@deptController.get("/list/exclude/{dept_id}", response_model=List[DeptModel], dependencies=[Depends(CheckUserInterfaceAuth('common'))])
|
||||
@deptController.get("/list/exclude/{dept_id}", response_model=List[DeptModel], dependencies=[Depends(CheckUserInterfaceAuth('system:dept:list'))])
|
||||
async def get_system_dept_tree_for_edit_option(request: Request, dept_id: int, query_db: Session = Depends(get_db), data_scope_sql: str = Depends(GetDataScope('SysDept'))):
|
||||
try:
|
||||
dept_query = DeptModel(deptId=dept_id)
|
||||
|
@@ -62,7 +62,7 @@ async def edit_system_dict_type(request: Request, edit_dict_type: DictTypeModel,
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@dictController.delete("/type/refreshCache", dependencies=[Depends(CheckUserInterfaceAuth('system:dict:edit'))])
|
||||
@dictController.delete("/type/refreshCache", dependencies=[Depends(CheckUserInterfaceAuth('system:dict:remove'))])
|
||||
@log_decorator(title='字典管理', business_type=2)
|
||||
async def refresh_system_dict(request: Request, query_db: Session = Depends(get_db)):
|
||||
try:
|
||||
@@ -95,7 +95,7 @@ async def delete_system_dict_type(request: Request, dict_ids: str, query_db: Ses
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@dictController.get("/type/optionselect", response_model=List[DictTypeModel], dependencies=[Depends(CheckUserInterfaceAuth('system:dict:query'))])
|
||||
@dictController.get("/type/optionselect", response_model=List[DictTypeModel])
|
||||
async def query_system_dict_type_options(request: Request, query_db: Session = Depends(get_db)):
|
||||
try:
|
||||
dict_type_query_result = DictTypeService.get_dict_type_list_services(query_db, DictTypePageQueryModel(**dict()), is_page=False)
|
||||
@@ -131,7 +131,7 @@ async def export_system_dict_type_list(request: Request, dict_type_page_query: D
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@dictController.get("/data/type/{dict_type}", dependencies=[Depends(CheckUserInterfaceAuth('system:dict:list'))])
|
||||
@dictController.get("/data/type/{dict_type}")
|
||||
async def query_system_dict_type_data(request: Request, dict_type: str, query_db: Session = Depends(get_db)):
|
||||
try:
|
||||
# 获取全量数据
|
||||
|
@@ -63,7 +63,7 @@ async def edit_system_job(request: Request, edit_job: EditJobModel, query_db: Se
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@jobController.put("/job/changeStatus", dependencies=[Depends(CheckUserInterfaceAuth('monitor:job:edit'))])
|
||||
@jobController.put("/job/changeStatus", dependencies=[Depends(CheckUserInterfaceAuth('monitor:job:changeStatus'))])
|
||||
@log_decorator(title='定时任务管理', business_type=2)
|
||||
async def edit_system_job(request: Request, edit_job: EditJobModel, query_db: Session = Depends(get_db), current_user: CurrentUserModel = Depends(LoginService.get_current_user)):
|
||||
try:
|
||||
|
@@ -70,7 +70,7 @@ async def export_system_operation_log_list(request: Request, operation_log_page_
|
||||
return ResponseUtil.streaming(data=bytes2file_response(operation_log_export_result))
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
return response_500(data="", message=str(e))
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@logController.get("/logininfor/list", response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('monitor:logininfor:list'))])
|
||||
|
@@ -41,11 +41,13 @@ async def login(request: Request, form_data: CustomOAuth2PasswordRequestForm = D
|
||||
},
|
||||
expires_delta=access_token_expires
|
||||
)
|
||||
await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}", access_token,
|
||||
ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
# 此方法可实现同一账号同一时间只能登录一次
|
||||
# await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{result[0].user_id}", access_token,
|
||||
# ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
if AppConfig.app_same_time_login:
|
||||
await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}", access_token,
|
||||
ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
else:
|
||||
# 此方法可实现同一账号同一时间只能登录一次
|
||||
await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{result[0].user_id}", access_token,
|
||||
ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
UserService.edit_user_services(query_db, EditUserModel(userId=result[0].user_id, loginDate=datetime.now(), type='status'))
|
||||
logger.info('登录成功')
|
||||
# 判断请求是否来自于api文档,如果是返回指定格式的结果,用于修复api文档认证成功后token显示undefined的bug
|
||||
@@ -131,7 +133,7 @@ async def register_user(request: Request, user_register: UserRegister, query_db:
|
||||
@loginController.post("/logout")
|
||||
async def logout(request: Request, token: Optional[str] = Depends(oauth2_scheme)):
|
||||
try:
|
||||
payload = jwt.decode(token, JwtConfig.jwt_secret_key, algorithms=[JwtConfig.jwt_algorithm])
|
||||
payload = jwt.decode(token, JwtConfig.jwt_secret_key, algorithms=[JwtConfig.jwt_algorithm], options={'verify_exp': False})
|
||||
session_id: str = payload.get("session_id")
|
||||
await LoginService.logout_services(request, session_id)
|
||||
logger.info('退出成功')
|
||||
|
@@ -12,7 +12,7 @@ from module_admin.annotation.log_annotation import log_decorator
|
||||
menuController = APIRouter(prefix='/system/menu', dependencies=[Depends(LoginService.get_current_user)])
|
||||
|
||||
|
||||
@menuController.get("/treeselect", dependencies=[Depends(CheckUserInterfaceAuth('common'))])
|
||||
@menuController.get("/treeselect")
|
||||
async def get_system_menu_tree(request: Request, query_db: Session = Depends(get_db), current_user: CurrentUserModel = Depends(LoginService.get_current_user)):
|
||||
try:
|
||||
menu_query_result = MenuService.get_menu_tree_services(query_db, current_user)
|
||||
@@ -23,7 +23,7 @@ async def get_system_menu_tree(request: Request, query_db: Session = Depends(get
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@menuController.get("/roleMenuTreeselect/{role_id}", dependencies=[Depends(CheckUserInterfaceAuth('common'))])
|
||||
@menuController.get("/roleMenuTreeselect/{role_id}")
|
||||
async def get_system_role_menu_tree(request: Request, role_id: int, query_db: Session = Depends(get_db), current_user: CurrentUserModel = Depends(LoginService.get_current_user)):
|
||||
try:
|
||||
role_menu_query_result = MenuService.get_role_menu_tree_services(query_db, role_id, current_user)
|
||||
|
@@ -17,7 +17,7 @@ from module_admin.annotation.log_annotation import log_decorator
|
||||
roleController = APIRouter(prefix='/system/role', dependencies=[Depends(LoginService.get_current_user)])
|
||||
|
||||
|
||||
@roleController.get("/deptTree/{role_id}", dependencies=[Depends(CheckUserInterfaceAuth('common'))])
|
||||
@roleController.get("/deptTree/{role_id}", dependencies=[Depends(CheckUserInterfaceAuth('system:role:query'))])
|
||||
async def get_system_role_dept_tree(request: Request, role_id: int, query_db: Session = Depends(get_db), data_scope_sql: str = Depends(GetDataScope('SysDept'))):
|
||||
try:
|
||||
dept_query_result = DeptService.get_dept_tree_services(query_db, DeptModel(**{}), data_scope_sql)
|
||||
@@ -160,7 +160,7 @@ async def reset_system_role_status(request: Request, edit_role: AddRoleModel, qu
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@roleController.get("/authUser/allocatedList", response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('common'))])
|
||||
@roleController.get("/authUser/allocatedList", response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('system:role:list'))])
|
||||
async def get_system_allocated_user_list(request: Request, user_role: UserRolePageQueryModel = Depends(UserRolePageQueryModel.as_query), query_db: Session = Depends(get_db)):
|
||||
try:
|
||||
role_user_allocated_page_query_result = RoleService.get_role_user_allocated_list_services(query_db, user_role, is_page=True)
|
||||
@@ -171,7 +171,7 @@ async def get_system_allocated_user_list(request: Request, user_role: UserRolePa
|
||||
return ResponseUtil.error(msg=str(e))
|
||||
|
||||
|
||||
@roleController.get("/authUser/unallocatedList", response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('common'))])
|
||||
@roleController.get("/authUser/unallocatedList", response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('system:role:list'))])
|
||||
async def get_system_unallocated_user_list(request: Request, user_role: UserRolePageQueryModel = Depends(UserRolePageQueryModel.as_query), query_db: Session = Depends(get_db)):
|
||||
try:
|
||||
role_user_unallocated_page_query_result = RoleService.get_role_user_unallocated_list_services(query_db, user_role, is_page=True)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
from sqlalchemy.orm import Session
|
||||
from module_admin.entity.do.dept_do import SysDept
|
||||
from module_admin.entity.do.role_do import SysRoleDept
|
||||
from module_admin.entity.vo.dept_vo import *
|
||||
from utils.time_format_util import list_format_datetime
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
from sqlalchemy import asc, desc
|
||||
from sqlalchemy.orm import Session
|
||||
from module_admin.entity.do.log_do import SysOperLog, SysLogininfor
|
||||
from module_admin.entity.vo.log_vo import *
|
||||
from utils.page_util import PageUtil
|
||||
from utils.common_util import CamelCaseUtil
|
||||
from datetime import datetime, time
|
||||
|
||||
|
||||
@@ -18,6 +20,12 @@ class OperationLogDao:
|
||||
:param is_page: 是否开启分页
|
||||
:return: 操作日志列表信息对象
|
||||
"""
|
||||
if query_object.is_asc == 'ascending':
|
||||
order_by_column = asc(getattr(SysOperLog, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
|
||||
elif query_object.is_asc == 'descending':
|
||||
order_by_column = desc(getattr(SysOperLog, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
|
||||
else:
|
||||
order_by_column = desc(SysOperLog.oper_time)
|
||||
query = db.query(SysOperLog) \
|
||||
.filter(SysOperLog.title.like(f'%{query_object.title}%') if query_object.title else True,
|
||||
SysOperLog.oper_name.like(f'%{query_object.oper_name}%') if query_object.oper_name else True,
|
||||
@@ -28,7 +36,7 @@ class OperationLogDao:
|
||||
datetime.combine(datetime.strptime(query_object.end_time, '%Y-%m-%d'), time(23, 59, 59)))
|
||||
if query_object.begin_time and query_object.end_time else True
|
||||
)\
|
||||
.distinct()
|
||||
.distinct().order_by(order_by_column)
|
||||
operation_log_list = PageUtil.paginate(query, query_object.page_num, query_object.page_size, is_page)
|
||||
|
||||
return operation_log_list
|
||||
@@ -84,6 +92,12 @@ class LoginLogDao:
|
||||
:param is_page: 是否开启分页
|
||||
:return: 登录日志列表信息对象
|
||||
"""
|
||||
if query_object.is_asc == 'ascending':
|
||||
order_by_column = asc(getattr(SysLogininfor, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
|
||||
elif query_object.is_asc == 'descending':
|
||||
order_by_column = desc(getattr(SysLogininfor, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
|
||||
else:
|
||||
order_by_column = desc(SysLogininfor.login_time)
|
||||
query = db.query(SysLogininfor) \
|
||||
.filter(SysLogininfor.ipaddr.like(f'%{query_object.ipaddr}%') if query_object.ipaddr else True,
|
||||
SysLogininfor.user_name.like(f'%{query_object.user_name}%') if query_object.user_name else True,
|
||||
@@ -93,7 +107,7 @@ class LoginLogDao:
|
||||
datetime.combine(datetime.strptime(query_object.end_time, '%Y-%m-%d'), time(23, 59, 59)))
|
||||
if query_object.begin_time and query_object.end_time else True
|
||||
)\
|
||||
.distinct()
|
||||
.distinct().order_by(order_by_column)
|
||||
login_log_list = PageUtil.paginate(query, query_object.page_num, query_object.page_size, is_page)
|
||||
|
||||
return login_log_list
|
||||
|
@@ -1,7 +1,7 @@
|
||||
from sqlalchemy import and_, or_, desc, func
|
||||
from sqlalchemy.orm import Session
|
||||
from module_admin.entity.do.user_do import SysUser, SysUserRole, SysUserPost
|
||||
from module_admin.entity.do.role_do import SysRole, SysRoleMenu
|
||||
from module_admin.entity.do.role_do import SysRole, SysRoleDept, SysRoleMenu
|
||||
from module_admin.entity.do.dept_do import SysDept
|
||||
from module_admin.entity.do.post_do import SysPost
|
||||
from module_admin.entity.do.menu_do import SysMenu
|
||||
|
@@ -51,6 +51,8 @@ class OperLogQueryModel(OperLogModel):
|
||||
"""
|
||||
操作日志管理不分页查询模型
|
||||
"""
|
||||
order_by_column: Optional[str] = None
|
||||
is_asc: Optional[str] = None
|
||||
begin_time: Optional[str] = None
|
||||
end_time: Optional[str] = None
|
||||
|
||||
@@ -78,6 +80,8 @@ class LoginLogQueryModel(LogininforModel):
|
||||
"""
|
||||
登录日志管理不分页查询模型
|
||||
"""
|
||||
order_by_column: Optional[str] = None
|
||||
is_asc: Optional[str] = None
|
||||
begin_time: Optional[str] = None
|
||||
end_time: Optional[str] = None
|
||||
|
||||
|
@@ -72,6 +72,7 @@ class JobService:
|
||||
if query_job:
|
||||
SchedulerUtil.remove_scheduler_job(job_id=edit_job.get('job_id'))
|
||||
if edit_job.get('status') == '0':
|
||||
job_info = cls.job_detail_services(query_db, edit_job.get('job_id'))
|
||||
SchedulerUtil.add_scheduler_job(job_info=job_info)
|
||||
query_db.commit()
|
||||
result = dict(is_success=True, message='更新成功')
|
||||
|
@@ -56,6 +56,7 @@ class LoginService:
|
||||
:param login_user: 登录用户对象
|
||||
:return: 校验结果
|
||||
"""
|
||||
await cls.__check_login_ip(request)
|
||||
account_lock = await request.app.state.redis.get(
|
||||
f"{RedisInitKeyConfig.ACCOUNT_LOCK.get('key')}:{login_user.user_name}")
|
||||
if login_user.user_name == account_lock:
|
||||
@@ -100,6 +101,21 @@ class LoginService:
|
||||
f"{RedisInitKeyConfig.PASSWORD_ERROR_COUNT.get('key')}:{login_user.user_name}")
|
||||
return user
|
||||
|
||||
@classmethod
|
||||
async def __check_login_ip(cls, request: Request):
|
||||
"""
|
||||
校验用户登录ip是否在黑名单内
|
||||
:param request: Request对象
|
||||
:return: 校验结果
|
||||
"""
|
||||
black_ip_value = await request.app.state.redis.get(
|
||||
f"{RedisInitKeyConfig.SYS_CONFIG.get('key')}:sys.login.blackIPList")
|
||||
black_ip_list = black_ip_value.split(',') if black_ip_value else []
|
||||
if request.headers.get('X-Forwarded-For') in black_ip_list:
|
||||
logger.warning("当前IP禁止登录")
|
||||
raise LoginException(data="", message="当前IP禁止登录")
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
async def __check_login_captcha(cls, request: Request, login_user: UserLogin):
|
||||
"""
|
||||
@@ -166,14 +182,18 @@ class LoginService:
|
||||
if query_user.get('user_basic_info') is None:
|
||||
logger.warning("用户token不合法")
|
||||
raise AuthException(data="", message="用户token不合法")
|
||||
redis_token = await request.app.state.redis.get(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}")
|
||||
# 此方法可实现同一账号同一时间只能登录一次
|
||||
# redis_token = await request.app.state.redis.get(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{user.user_basic_info.user_id}")
|
||||
if AppConfig.app_same_time_login:
|
||||
redis_token = await request.app.state.redis.get(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}")
|
||||
else:
|
||||
# 此方法可实现同一账号同一时间只能登录一次
|
||||
redis_token = await request.app.state.redis.get(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{query_user.get('user_basic_info').user_id}")
|
||||
if token == redis_token:
|
||||
await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}", redis_token,
|
||||
ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
# await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{user.user_basic_info.user_id}", redis_token,
|
||||
# ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
if AppConfig.app_same_time_login:
|
||||
await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{session_id}", redis_token,
|
||||
ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
else:
|
||||
await request.app.state.redis.set(f"{RedisInitKeyConfig.ACCESS_TOKEN.get('key')}:{query_user.get('user_basic_info').user_id}", redis_token,
|
||||
ex=timedelta(minutes=JwtConfig.jwt_redis_expire_minutes))
|
||||
|
||||
role_id_list = [item.role_id for item in query_user.get('user_role_info')]
|
||||
if 1 in role_id_list:
|
||||
@@ -209,7 +229,7 @@ class LoginService:
|
||||
:return: 当前用户路由信息对象
|
||||
"""
|
||||
query_user = UserDao.get_user_by_id(query_db, user_id=user_id)
|
||||
user_router_menu = [row for row in query_user.get('user_menu_info') if row.menu_type in ['M', 'C']]
|
||||
user_router_menu = sorted([row for row in query_user.get('user_menu_info') if row.menu_type in ['M', 'C']], key=lambda x: x.order_num)
|
||||
user_router = cls.__generate_user_router_menu(0, user_router_menu)
|
||||
return user_router
|
||||
|
||||
@@ -229,14 +249,16 @@ class LoginService:
|
||||
if permission.menu_type == 'M':
|
||||
router_list_data['name'] = permission.path.capitalize()
|
||||
router_list_data['hidden'] = False if permission.visible == '0' else True
|
||||
if permission.is_frame == 1:
|
||||
router_list_data['redirect'] = 'noRedirect'
|
||||
if permission.parent_id == 0:
|
||||
router_list_data['component'] = 'Layout'
|
||||
router_list_data['path'] = f'/{permission.path}'
|
||||
else:
|
||||
router_list_data['component'] = 'ParentView'
|
||||
router_list_data['path'] = permission.path
|
||||
if permission.is_frame == 1:
|
||||
router_list_data['redirect'] = 'noRedirect'
|
||||
else:
|
||||
router_list_data['path'] = permission.path
|
||||
if children:
|
||||
router_list_data['alwaysShow'] = True
|
||||
router_list_data['children'] = children
|
||||
@@ -249,6 +271,7 @@ class LoginService:
|
||||
elif permission.menu_type == 'C':
|
||||
router_list_data['name'] = permission.path.capitalize()
|
||||
router_list_data['path'] = permission.path
|
||||
router_list_data['query'] = permission.query
|
||||
router_list_data['hidden'] = False if permission.visible == '0' else True
|
||||
router_list_data['component'] = permission.component
|
||||
router_list_data['meta'] = {
|
||||
|
@@ -131,7 +131,7 @@ class RoleService:
|
||||
:param page_object: 角色数据权限对象
|
||||
:return: 分配角色数据权限结果
|
||||
"""
|
||||
edit_role = page_object.model_dump(exclude_unset=True)
|
||||
edit_role = page_object.model_dump(exclude_unset=True, exclude={'admin'})
|
||||
del edit_role['dept_ids']
|
||||
role_info = cls.role_detail_services(query_db, edit_role.get('role_id'))
|
||||
if role_info:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
APScheduler==3.10.4
|
||||
DateTime==5.4
|
||||
fastapi[all]==0.109.0
|
||||
fastapi[all]==0.109.1
|
||||
loguru==0.7.2
|
||||
openpyxl==3.1.2
|
||||
pandas==2.1.4
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import pandas as pd
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
from openpyxl import Workbook
|
||||
from openpyxl.styles import Alignment, PatternFill
|
||||
from openpyxl.utils import get_column_letter
|
||||
@@ -39,10 +40,21 @@ def worship():
|
||||
|
||||
class CamelCaseUtil:
|
||||
"""
|
||||
下划线形式(snake_case)转换为小驼峰形式(camelCase)工具方法
|
||||
小驼峰形式(camelCase)与下划线形式(snake_case)互相转换工具方法
|
||||
"""
|
||||
@classmethod
|
||||
def __to_camel_case(cls, snake_str):
|
||||
def camel_to_snake(cls, camel_str):
|
||||
"""
|
||||
小驼峰形式字符串(camelCase)转换为下划线形式字符串(snake_case)
|
||||
:param camel_str: 小驼峰形式字符串
|
||||
:return: 下划线形式字符串
|
||||
"""
|
||||
# 在大写字母前添加一个下划线,然后将整个字符串转为小写
|
||||
words = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel_str)
|
||||
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', words).lower()
|
||||
|
||||
@classmethod
|
||||
def snake_to_camel(cls, snake_str):
|
||||
"""
|
||||
下划线形式字符串(snake_case)转换为小驼峰形式字符串(camelCase)
|
||||
:param snake_str: 下划线形式字符串
|
||||
@@ -64,7 +76,7 @@ class CamelCaseUtil:
|
||||
return result
|
||||
# 如果是字典,直接转换键
|
||||
elif isinstance(result, dict):
|
||||
return {cls.__to_camel_case(k): v for k, v in result.items()}
|
||||
return {cls.snake_to_camel(k): v for k, v in result.items()}
|
||||
# 如果是一组字典或其他类型的列表,遍历列表进行转换
|
||||
elif isinstance(result, list):
|
||||
return [cls.transform_result(row) if isinstance(row, (dict, Row)) else (cls.transform_result({c.name: getattr(row, c.name) for c in row.__table__.columns}) if row else row) for row in result]
|
||||
|
@@ -4,5 +4,5 @@ VITE_APP_TITLE = vfadmin管理系统
|
||||
# 开发环境配置
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 若依管理系统/开发环境
|
||||
# vfadmin管理系统/开发环境
|
||||
VITE_APP_BASE_API = '/dev-api'
|
||||
|
@@ -4,7 +4,7 @@ VITE_APP_TITLE = vfadmin管理系统
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
# 若依管理系统/生产环境
|
||||
# vfadmin管理系统/生产环境
|
||||
VITE_APP_BASE_API = '/prod-api'
|
||||
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
|
@@ -1,10 +1,10 @@
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 若依管理系统
|
||||
VITE_APP_TITLE = vfadmin管理系统
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'staging'
|
||||
|
||||
# 若依管理系统/生产环境
|
||||
# vfadmin管理系统/生产环境
|
||||
VITE_APP_BASE_API = '/stage-api'
|
||||
|
||||
# 是否在打包时开启压缩,支持 gzip 和 brotli
|
||||
|
@@ -1,109 +0,0 @@
|
||||
<p align="center">
|
||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
||||
</p>
|
||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.8.7</h1>
|
||||
<h4 align="center">基于SpringBoot+Vue3前后端分离的Java快速开发框架</h4>
|
||||
<p align="center">
|
||||
<a href="https://gitee.com/y_project/RuoYi-Vue/stargazers"><img src="https://gitee.com/y_project/RuoYi-Vue/badge/star.svg?theme=dark"></a>
|
||||
<a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.8.7-brightgreen.svg"></a>
|
||||
<a href="https://gitee.com/y_project/RuoYi-Vue/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||
</p>
|
||||
|
||||
## 平台简介
|
||||
|
||||
* 本仓库为前端技术栈 [Vue3](https://v3.cn.vuejs.org) + [Element Plus](https://element-plus.org/zh-CN) + [Vite](https://cn.vitejs.dev) 版本。
|
||||
* 配套后端代码仓库地址[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue) 或 [RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast) 版本。
|
||||
* 前端技术栈([Vue2](https://cn.vuejs.org) + [Element](https://github.com/ElemeFE/element) + [Vue CLI](https://cli.vuejs.org/zh)),请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue/tree/master/ruoyi-ui)。
|
||||
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)
|
||||
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
|
||||
|
||||
## 前端运行
|
||||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone https://github.com/yangzongzhuan/RuoYi-Vue3.git
|
||||
|
||||
# 进入项目目录
|
||||
cd RuoYi-Vue3
|
||||
|
||||
# 安装依赖
|
||||
yarn --registry=https://registry.npmmirror.com
|
||||
|
||||
# 启动服务
|
||||
yarn dev
|
||||
|
||||
# 构建测试环境 yarn build:stage
|
||||
# 构建生产环境 yarn build:prod
|
||||
# 前端访问地址 http://localhost:80
|
||||
```
|
||||
|
||||
## 内置功能
|
||||
|
||||
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
|
||||
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
|
||||
3. 岗位管理:配置系统用户所属担任职务。
|
||||
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
|
||||
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
|
||||
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
|
||||
7. 参数管理:对系统动态配置常用参数。
|
||||
8. 通知公告:系统通知公告信息发布维护。
|
||||
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
|
||||
10. 登录日志:系统登录日志记录查询包含登录异常。
|
||||
11. 在线用户:当前系统中活跃用户状态监控。
|
||||
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
|
||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
||||
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
||||
16. 缓存监控:对系统的缓存信息查询,命令统计等。
|
||||
17. 在线构建器:拖动表单元素生成相应的HTML代码。
|
||||
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
||||
|
||||
## 在线体验
|
||||
|
||||
- admin/admin123
|
||||
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
|
||||
|
||||
演示地址:http://vue.ruoyi.vip
|
||||
文档地址:http://doc.ruoyi.vip
|
||||
|
||||
## 演示图
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
## 若依前后端分离交流群
|
||||
|
||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=5bVB1og) [](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [](https://jq.qq.com/?_wv=1027&k=51G72yr) [](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [](https://jq.qq.com/?_wv=1027&k=SpyH2875) [](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) [](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Fn2aF5IHpwsy8j6VlalNJK6qbwFLFHat&authKey=uyIT%2B97x2AXj3odyXpsSpVaPMC%2Bidw0LxG5MAtEqlrcBcWJUA%2FeS43rsF1Tg7IRJ&noverify=0&group_code=161281055) 点击按钮入群。
|
@@ -7,7 +7,7 @@
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<title>若依管理系统</title>
|
||||
<title>vfadmin管理系统</title>
|
||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||
<style>
|
||||
html,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vfadmin",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.1",
|
||||
"description": "vfadmin管理系统",
|
||||
"author": "insistence",
|
||||
"license": "MIT",
|
||||
|
@@ -152,8 +152,8 @@
|
||||
</span>
|
||||
</template>
|
||||
<el-radio-group v-model="form.isFrame">
|
||||
<el-radio label="0">是</el-radio>
|
||||
<el-radio label="1">否</el-radio>
|
||||
<el-radio :label="0">是</el-radio>
|
||||
<el-radio :label="1">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -220,8 +220,8 @@
|
||||
</span>
|
||||
</template>
|
||||
<el-radio-group v-model="form.isCache">
|
||||
<el-radio label="0">缓存</el-radio>
|
||||
<el-radio label="1">不缓存</el-radio>
|
||||
<el-radio :label="0">缓存</el-radio>
|
||||
<el-radio :label="1">不缓存</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -339,8 +339,8 @@ function reset() {
|
||||
icon: undefined,
|
||||
menuType: "M",
|
||||
orderNum: undefined,
|
||||
isFrame: "1",
|
||||
isCache: "0",
|
||||
isFrame: 1,
|
||||
isCache: 0,
|
||||
visible: "0",
|
||||
status: "0"
|
||||
};
|
||||
|
Reference in New Issue
Block a user