- 拆分应用工厂、业务服务与路由,保留原有 HTTP/SSE 和存储入口 - 分离页面资源,重排客服工作台并完善响应式导航、草稿和附件交互 - 整理维护脚本、请求示例和贡献指南,移除启动脚本中的密钥配置 - 上传文件改为仅本地保留,补充隔离的后端与前端回归验证 验证:46 项 Python 测试通过,含 14 个已有子测试;12 个 Node 前端场景通过。
32 lines
784 B
Python
32 lines
784 B
Python
"""HTTP adapters for admin; business logic lives in services."""
|
|
|
|
from flask import Blueprint, Response, render_template, request
|
|
|
|
from .. import business_service
|
|
|
|
bp = Blueprint('admin', __name__)
|
|
|
|
@bp.route('/api/admin/stats')
|
|
def admin_stats():
|
|
return business_service.admin_stats()
|
|
|
|
|
|
@bp.route('/admin/login', methods=['POST'])
|
|
def admin_login():
|
|
return business_service.admin_login(request.json or {})
|
|
|
|
|
|
@bp.route('/api/export_chat')
|
|
def export_chat():
|
|
return Response(business_service.export_chat(), mimetype='text/csv', headers={'Content-Disposition': 'attachment;filename=chat_export.csv'})
|
|
|
|
|
|
@bp.route('/admin')
|
|
def admin():
|
|
return render_template('admin_login.html')
|
|
|
|
|
|
@bp.route('/admin/dashboard')
|
|
def admin_dash():
|
|
return render_template('admin.html')
|