From 1b7b5b10494dd79bdce42891fb2d007a17a9928e Mon Sep 17 00:00:00 2001 From: SZCJW <792430652@qq.com> Date: Sun, 8 Mar 2026 01:56:02 +0800 Subject: [PATCH] x --- src/services/storage_integration_rustfs.py | 8 +++++--- static/vue-app.js | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/services/storage_integration_rustfs.py b/src/services/storage_integration_rustfs.py index cf70a8f..806336f 100644 --- a/src/services/storage_integration_rustfs.py +++ b/src/services/storage_integration_rustfs.py @@ -49,6 +49,7 @@ class StorageIntegrationService: batch_id = upload_batch or str(uuid.uuid4()) # 2. 创建新PostgreSQL记录(每次上传都创建新记录) + from datetime import datetime stp_file = STPFile( user_id=user_id, object_key=upload_result['object_key'], @@ -58,7 +59,8 @@ class StorageIntegrationService: file_hash=file_hash, upload_batch=batch_id, status="uploaded", - file_path=str(file_path) + file_path=str(file_path), + upload_time=datetime.now() ) session.add(stp_file) @@ -571,7 +573,7 @@ class StorageIntegrationService: 'id': f.id, 'task_id': f.processing_tasks[0].task_id if f.processing_tasks else None, 'upload_batch': f.upload_batch, - 'upload_time': f.upload_time.isoformat() if f.upload_time else None, + 'upload_time': f.upload_time.strftime('%Y-%m-%d %H:%M:%S') if f.upload_time else None, 'file_size': f.file_size, 'status': f.status, 'volume': f.volume, @@ -644,7 +646,7 @@ class StorageIntegrationService: 'filename': f.original_filename, 'latest_id': f.id, 'latest_task_id': task_id, - 'latest_upload_time': f.upload_time.isoformat() if f.upload_time else None, + 'latest_upload_time': f.upload_time.strftime('%Y-%m-%d %H:%M:%S') if f.upload_time else None, 'latest_status': f.status, 'upload_count': upload_count, 'file_size': f.file_size, diff --git a/static/vue-app.js b/static/vue-app.js index 9819b42..9848d26 100644 --- a/static/vue-app.js +++ b/static/vue-app.js @@ -32,7 +32,15 @@ function formatNumber(num) { function formatDateTime(dateString) { if (!dateString) return "N/A"; try { - return new Date(dateString).toLocaleString('zh-CN'); + const date = new Date(dateString); + if (isNaN(date.getTime())) return dateString; + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; } catch { return dateString; }