!9 RuoYi-Vue3-FastAPI v1.1.2
Merge pull request !9 from insistence/develop
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi-Vue3-FastAPI v1.1.1</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi-Vue3-FastAPI v1.1.2</h1>
|
||||||
<h4 align="center">基于RuoYi-Vue3+FastAPI前后端分离的快速开发框架</h4>
|
<h4 align="center">基于RuoYi-Vue3+FastAPI前后端分离的快速开发框架</h4>
|
||||||
<p align="center">
|
<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://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://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.1.1-brightgreen.svg"></a>
|
<a href="https://gitee.com/insistence2022/RuoYi-Vue3-FastAPI"><img src="https://img.shields.io/badge/RuoYiVue3FastAPI-v1.1.2-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>
|
<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/python-≥3.8-blue">
|
||||||
<img src="https://img.shields.io/badge/MySQL-≥5.7-blue">
|
<img src="https://img.shields.io/badge/MySQL-≥5.7-blue">
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 平台简介
|
## 平台简介
|
||||||
|
|
||||||
RuoYi-Vue3-FastAPI是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
RuoYi-Vue3-FastAPI是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||||
|
@@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0'
|
|||||||
# 应用端口
|
# 应用端口
|
||||||
APP_PORT = 9099
|
APP_PORT = 9099
|
||||||
# 应用版本
|
# 应用版本
|
||||||
APP_VERSION= '1.1.1'
|
APP_VERSION= '1.1.2'
|
||||||
# 应用是否开启热重载
|
# 应用是否开启热重载
|
||||||
APP_RELOAD = true
|
APP_RELOAD = true
|
||||||
# 应用是否开启IP归属区域查询
|
# 应用是否开启IP归属区域查询
|
||||||
@@ -42,6 +42,14 @@ DB_PASSWORD = 'mysqlroot'
|
|||||||
DB_DATABASE = 'ruoyi-fastapi'
|
DB_DATABASE = 'ruoyi-fastapi'
|
||||||
# 是否开启sqlalchemy日志
|
# 是否开启sqlalchemy日志
|
||||||
DB_ECHO = true
|
DB_ECHO = true
|
||||||
|
# 允许溢出连接池大小的最大连接数
|
||||||
|
DB_MAX_OVERFLOW = 10
|
||||||
|
# 连接池大小,0表示连接数无限制
|
||||||
|
DB_POOL_SIZE = 50
|
||||||
|
# 连接回收时间(单位:秒)
|
||||||
|
DB_POOL_RECYCLE = 3600
|
||||||
|
# 连接池中没有线程可用时,最多等待的时间(单位:秒)
|
||||||
|
DB_POOL_TIMEOUT = 30
|
||||||
|
|
||||||
# -------- Redis配置 --------
|
# -------- Redis配置 --------
|
||||||
# Redis主机
|
# Redis主机
|
||||||
|
@@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0'
|
|||||||
# 应用端口
|
# 应用端口
|
||||||
APP_PORT = 9099
|
APP_PORT = 9099
|
||||||
# 应用版本
|
# 应用版本
|
||||||
APP_VERSION= '1.1.1'
|
APP_VERSION= '1.1.2'
|
||||||
# 应用是否开启热重载
|
# 应用是否开启热重载
|
||||||
APP_RELOAD = false
|
APP_RELOAD = false
|
||||||
# 应用是否开启IP归属区域查询
|
# 应用是否开启IP归属区域查询
|
||||||
@@ -42,6 +42,14 @@ DB_PASSWORD = 'root'
|
|||||||
DB_DATABASE = 'ruoyi-fastapi'
|
DB_DATABASE = 'ruoyi-fastapi'
|
||||||
# 是否开启sqlalchemy日志
|
# 是否开启sqlalchemy日志
|
||||||
DB_ECHO = true
|
DB_ECHO = true
|
||||||
|
# 允许溢出连接池大小的最大连接数
|
||||||
|
DB_MAX_OVERFLOW = 10
|
||||||
|
# 连接池大小,0表示连接数无限制
|
||||||
|
DB_POOL_SIZE = 50
|
||||||
|
# 连接回收时间(单位:秒)
|
||||||
|
DB_POOL_RECYCLE = 3600
|
||||||
|
# 连接池中没有线程可用时,最多等待的时间(单位:秒)
|
||||||
|
DB_POOL_TIMEOUT = 30
|
||||||
|
|
||||||
# -------- Redis配置 --------
|
# -------- Redis配置 --------
|
||||||
# Redis主机
|
# Redis主机
|
||||||
|
@@ -8,7 +8,12 @@ SQLALCHEMY_DATABASE_URL = f"mysql+pymysql://{DataBaseConfig.db_username}:{quote_
|
|||||||
f"{DataBaseConfig.db_host}:{DataBaseConfig.db_port}/{DataBaseConfig.db_database}"
|
f"{DataBaseConfig.db_host}:{DataBaseConfig.db_port}/{DataBaseConfig.db_database}"
|
||||||
|
|
||||||
engine = create_engine(
|
engine = create_engine(
|
||||||
SQLALCHEMY_DATABASE_URL, echo=DataBaseConfig.db_echo
|
SQLALCHEMY_DATABASE_URL,
|
||||||
|
echo=DataBaseConfig.db_echo,
|
||||||
|
max_overflow=DataBaseConfig.db_max_overflow,
|
||||||
|
pool_size=DataBaseConfig.db_pool_size,
|
||||||
|
pool_recycle=DataBaseConfig.db_pool_recycle,
|
||||||
|
pool_timeout=DataBaseConfig.db_pool_timeout
|
||||||
)
|
)
|
||||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
@@ -41,6 +41,10 @@ class DataBaseSettings(BaseSettings):
|
|||||||
db_password: str = 'mysqlroot'
|
db_password: str = 'mysqlroot'
|
||||||
db_database: str = 'ruoyi-fastapi'
|
db_database: str = 'ruoyi-fastapi'
|
||||||
db_echo: bool = True
|
db_echo: bool = True
|
||||||
|
db_max_overflow: int = 10
|
||||||
|
db_pool_size: int = 50
|
||||||
|
db_pool_recycle: int = 3600
|
||||||
|
db_pool_timeout: int = 30
|
||||||
|
|
||||||
|
|
||||||
class RedisSettings(BaseSettings):
|
class RedisSettings(BaseSettings):
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from functools import wraps
|
from functools import wraps, lru_cache
|
||||||
from fastapi import Request
|
from fastapi import Request
|
||||||
from fastapi.responses import JSONResponse, ORJSONResponse, UJSONResponse
|
from fastapi.responses import JSONResponse, ORJSONResponse, UJSONResponse
|
||||||
import inspect
|
import inspect
|
||||||
@@ -52,21 +52,7 @@ def log_decorator(title: str, business_type: int, log_type: Optional[str] = 'ope
|
|||||||
oper_ip = request.headers.get("X-Forwarded-For")
|
oper_ip = request.headers.get("X-Forwarded-For")
|
||||||
oper_location = '内网IP'
|
oper_location = '内网IP'
|
||||||
if AppConfig.app_ip_location_query:
|
if AppConfig.app_ip_location_query:
|
||||||
try:
|
oper_location = get_ip_location(oper_ip)
|
||||||
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 = '未知'
|
|
||||||
except Exception as e:
|
|
||||||
oper_location = '未知'
|
|
||||||
print(e)
|
|
||||||
# 根据不同的请求类型使用不同的方法获取请求参数
|
# 根据不同的请求类型使用不同的方法获取请求参数
|
||||||
content_type = request.headers.get("Content-Type")
|
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):
|
if content_type and ("multipart/form-data" in content_type or 'application/x-www-form-urlencoded' in content_type):
|
||||||
@@ -175,3 +161,26 @@ def log_decorator(title: str, business_type: int, log_type: Optional[str] = 'ope
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache()
|
||||||
|
def get_ip_location(oper_ip: str):
|
||||||
|
"""
|
||||||
|
查询ip归属区域
|
||||||
|
:param oper_ip: 需要查询的ip
|
||||||
|
:return: ip归属区域
|
||||||
|
"""
|
||||||
|
oper_location = '内网IP'
|
||||||
|
try:
|
||||||
|
if oper_ip != '127.0.0.1' and oper_ip != 'localhost':
|
||||||
|
oper_location = '未知'
|
||||||
|
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}'
|
||||||
|
except Exception as e:
|
||||||
|
oper_location = '未知'
|
||||||
|
print(e)
|
||||||
|
return oper_location
|
||||||
|
@@ -206,7 +206,7 @@ class UserService:
|
|||||||
:param page_object: 重置用户对象
|
:param page_object: 重置用户对象
|
||||||
:return: 重置用户校验结果
|
:return: 重置用户校验结果
|
||||||
"""
|
"""
|
||||||
reset_user = page_object.model_dump(exclude_unset=True)
|
reset_user = page_object.model_dump(exclude_unset=True, exclude={'admin'})
|
||||||
if page_object.old_password:
|
if page_object.old_password:
|
||||||
user = UserDao.get_user_detail_by_id(query_db, user_id=page_object.user_id).get('user_basic_info')
|
user = UserDao.get_user_detail_by_id(query_db, user_id=page_object.user_id).get('user_basic_info')
|
||||||
if not PwdUtil.verify_password(page_object.old_password, user.password):
|
if not PwdUtil.verify_password(page_object.old_password, user.password):
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vfadmin",
|
"name": "vfadmin",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "vfadmin管理系统",
|
"description": "vfadmin管理系统",
|
||||||
"author": "insistence",
|
"author": "insistence",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Reference in New Issue
Block a user