v4.4 数据报表/操作日志/系统设置与月度分排行
1. 月度分排行:管理端首页支持总分/月度分切换与月份选择,新增排行榜导出CSV 2. 数据报表:新增考勤/作业统计页(日期范围、汇总与每人明细、CSV导出) 3. 操作日志:新增查看页(操作类型/操作人/日期筛选,分页) 4. 系统设置:密码策略可配置(长度/字符种类),全站改密与重置统一校验、前端提示同步;策略通过公开配置下发 5. 学期归档对比:查看归档时展示与上一学期的分数变化与名次升降 6. 历史记录导出支持按学生分表(每人一段,便于发家长) 7. 移动端适配:导航横向滚动、表格触控滚动、字号与弹窗优化 8. 版本升级至4.4(无数据库结构变更)
This commit is contained in:
1 parent
9a19add6c1
commit
768ea281e0
54 files changed
+1782
-90
No files matched your search
@@ -0,0 +1,74 @@
|
||||
# ===========================================
|
||||
# 班级操行分管理系统 - 系统设置服务
|
||||
#
|
||||
# 开发者: Canglan
|
||||
# 联系方式: admin@sea-studio.top
|
||||
# 版权归属: Sea Network Technology Studio
|
||||
# 许可证: MIT License
|
||||
#
|
||||
# 版权所有 © Sea Network Technology Studio
|
||||
# ===========================================
|
||||
|
||||
from typing import Dict, Any
|
||||
from models.system_setting import SystemSettingModel
|
||||
from utils.logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
# 密码策略默认值(未配置时使用)
|
||||
DEFAULT_PASSWORD_POLICY = {
|
||||
"min_length": 6,
|
||||
"max_length": 20,
|
||||
"min_types": 3
|
||||
}
|
||||
|
||||
|
||||
class SettingService:
|
||||
"""系统设置服务"""
|
||||
|
||||
@staticmethod
|
||||
async def get_password_policy() -> Dict[str, int]:
|
||||
"""获取密码策略(长度范围与最少字符种类数)"""
|
||||
values = await SystemSettingModel.get_many([
|
||||
"password_min_length", "password_max_length", "password_min_types"
|
||||
])
|
||||
policy = dict(DEFAULT_PASSWORD_POLICY)
|
||||
|
||||
def parse_int(key: str, default: int, low: int, high: int) -> int:
|
||||
try:
|
||||
value = int(values.get(key, ""))
|
||||
except (TypeError, ValueError):
|
||||
return default
|
||||
return max(low, min(high, value))
|
||||
|
||||
policy["min_length"] = parse_int("password_min_length", policy["min_length"], 4, 64)
|
||||
policy["max_length"] = parse_int("password_max_length", policy["max_length"], 8, 100)
|
||||
policy["min_types"] = parse_int("password_min_types", policy["min_types"], 1, 4)
|
||||
if policy["min_length"] > policy["max_length"]:
|
||||
policy["min_length"] = policy["max_length"]
|
||||
return policy
|
||||
|
||||
@staticmethod
|
||||
async def update_password_policy(
|
||||
min_length: int,
|
||||
max_length: int,
|
||||
min_types: int,
|
||||
operator_id: int = None
|
||||
) -> Dict[str, Any]:
|
||||
"""更新密码策略"""
|
||||
if not (4 <= min_length <= 64):
|
||||
return {"success": False, "message": "最小长度需在4-64之间"}
|
||||
if not (8 <= max_length <= 100):
|
||||
return {"success": False, "message": "最大长度需在8-100之间"}
|
||||
if min_length > max_length:
|
||||
return {"success": False, "message": "最小长度不能大于最大长度"}
|
||||
if not (1 <= min_types <= 4):
|
||||
return {"success": False, "message": "字符种类数需在1-4之间"}
|
||||
|
||||
await SystemSettingModel.upsert("password_min_length", str(min_length))
|
||||
await SystemSettingModel.upsert("password_max_length", str(max_length))
|
||||
await SystemSettingModel.upsert("password_min_types", str(min_types))
|
||||
logger.info(
|
||||
f"用户[{operator_id}] 更新密码策略: {min_length}-{max_length}位, 至少{min_types}种字符"
|
||||
)
|
||||
return {"success": True, "message": "密码策略已保存"}
|
||||
Reference in new issue
Block a user