feat:导出文件命名+旧图标隐藏

This commit is contained in:
liailing1026
2026-03-13 16:43:26 +08:00
parent 01cdb71903
commit 05f6a07d26
8 changed files with 73 additions and 57 deletions

View File

@@ -3049,11 +3049,9 @@ def ensure_export_dir(task_id: str) -> str:
def generate_export_file_name(task_name: str, export_type: str) -> str:
"""生成导出文件名"""
from datetime import datetime
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
# 清理文件名中的非法字符
safe_name = "".join(c for c in task_name if c.isalnum() or c in (' ', '-', '_')).strip()
return f"{safe_name}_{export_type}_{timestamp}"
return f"{safe_name}_{export_type}"
@socketio.on('export')
@@ -3243,7 +3241,7 @@ def handle_get_export_list(data):
# ==================== REST API 接口 ====================
@app.route('/api/export/<int:record_id>/download', methods=['GET'])
@app.route('/export/<int:record_id>/download', methods=['GET'])
def download_export(record_id: int):
"""下载导出文件"""
try:
@@ -3270,7 +3268,7 @@ def download_export(record_id: int):
return jsonify({'error': str(e)}), 500
@app.route('/api/export/<int:record_id>/preview', methods=['GET'])
@app.route('/export/<int:record_id>/preview', methods=['GET'])
def preview_export(record_id: int):
"""预览导出文件"""
try:
@@ -3332,7 +3330,7 @@ def preview_export(record_id: int):
return jsonify({'error': str(e)}), 500
@app.route('/api/export/<int:record_id>/share', methods=['GET'])
@app.route('/export/<int:record_id>/share', methods=['GET'])
def share_export(record_id: int):
"""生成分享链接"""
try:
@@ -3355,7 +3353,7 @@ def share_export(record_id: int):
return jsonify({'error': str(e)}), 500
@app.route('/api/export/<int:record_id>/share/info', methods=['GET'])
@app.route('/export/<int:record_id>/share/info', methods=['GET'])
def get_share_info(record_id: int):
"""获取分享文件信息(无需登录验证)"""
try:
@@ -3407,7 +3405,7 @@ def get_shared_plan_page(share_token: str):
return jsonify({'error': str(e)}), 500
@app.route('/api/share/<share_token>/check', methods=['GET'])
@app.route('/share/<share_token>/check', methods=['GET'])
def check_share_code(share_token: str):
"""检查分享链接是否需要提取码"""
try:
@@ -3431,7 +3429,7 @@ def check_share_code(share_token: str):
return jsonify({'error': str(e)}), 500
@app.route('/api/share/<share_token>', methods=['GET'])
@app.route('/share/<share_token>', methods=['GET'])
def get_shared_plan_info(share_token: str):
"""获取分享任务详情API 接口,无需登录验证)"""
# 获取URL参数中的提取码
@@ -3473,7 +3471,7 @@ def get_shared_plan_info(share_token: str):
return jsonify({'error': str(e)}), 500
@app.route('/api/share/import', methods=['POST'])
@app.route('/share/import', methods=['POST'])
def import_shared_plan():
"""导入分享的任务到自己的历史记录HTTP API无需 WebSocket"""
try:
@@ -3537,7 +3535,7 @@ def import_shared_plan():
return jsonify({'error': str(e)}), 500
@app.route('/api/export/<int:record_id>', methods=['DELETE'])
@app.route('/export/<int:record_id>', methods=['DELETE'])
def delete_export(record_id: int):
"""删除导出记录"""
try: