feat(phase4): 全部业务模块迁移到 modules/(结构迁移)
- 21 个模块目录(auth/system/dictionary/configuration/cms/member/region/link/notice/job/log/upload/index) - 每个模块 router.py(合并模块导出多个 router)/schemas.py/service.py/repository.py/models.py - routers/v1.py 与 routers/__init__.py 改为直接引用 modules,前缀与权限串原样保留 - core/middleware.py 懒加载指向 modules.system.menu / modules.log;core/redis_client.py 指向 modules.job.scheduler - apps/views|services|forms 全部改为 re-export 垫片 - 迁移后 grep 守门通过:modules/core 无 apps/extensions 残留引用 - 实测登录、27+ 模块接口、写操作 commit、操作日志落库均正常 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
from fastapi import APIRouter, Request
|
||||
|
||||
from modules.auth.schemas import LoginForm
|
||||
from modules.auth import service as login
|
||||
from core import R
|
||||
from utils.captcha import generate_captcha
|
||||
|
||||
# 创建路由
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
# 系统登录
|
||||
@router.post('/login', summary='系统登录')
|
||||
async def do_login(request: Request, data: LoginForm):
|
||||
result = await login.login(request, data)
|
||||
return result
|
||||
|
||||
|
||||
# 获取验证码
|
||||
@router.get('/captcha', summary='获取验证码')
|
||||
async def captcha(request: Request):
|
||||
# 生成验证码
|
||||
result = await generate_captcha(request)
|
||||
# idKey值
|
||||
idKey = result['idKey']
|
||||
# 验证码base64字符串
|
||||
data = result['data']
|
||||
# 将图片转换为base64
|
||||
imgStr = "data:image/png;base64," + data
|
||||
# 返回结果
|
||||
return R.ok(idkey=idKey, data=imgStr)
|
||||
Reference in New Issue
Block a user