This commit is contained in:
2026-03-08 01:56:02 +08:00
parent 7f770239e3
commit 1b7b5b1049
2 changed files with 14 additions and 4 deletions
+5 -3
View File
@@ -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,
+9 -1
View File
@@ -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;
}