x
This commit is contained in:
@@ -49,6 +49,7 @@ class StorageIntegrationService:
|
|||||||
batch_id = upload_batch or str(uuid.uuid4())
|
batch_id = upload_batch or str(uuid.uuid4())
|
||||||
|
|
||||||
# 2. 创建新PostgreSQL记录(每次上传都创建新记录)
|
# 2. 创建新PostgreSQL记录(每次上传都创建新记录)
|
||||||
|
from datetime import datetime
|
||||||
stp_file = STPFile(
|
stp_file = STPFile(
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
object_key=upload_result['object_key'],
|
object_key=upload_result['object_key'],
|
||||||
@@ -58,7 +59,8 @@ class StorageIntegrationService:
|
|||||||
file_hash=file_hash,
|
file_hash=file_hash,
|
||||||
upload_batch=batch_id,
|
upload_batch=batch_id,
|
||||||
status="uploaded",
|
status="uploaded",
|
||||||
file_path=str(file_path)
|
file_path=str(file_path),
|
||||||
|
upload_time=datetime.now()
|
||||||
)
|
)
|
||||||
|
|
||||||
session.add(stp_file)
|
session.add(stp_file)
|
||||||
@@ -571,7 +573,7 @@ class StorageIntegrationService:
|
|||||||
'id': f.id,
|
'id': f.id,
|
||||||
'task_id': f.processing_tasks[0].task_id if f.processing_tasks else None,
|
'task_id': f.processing_tasks[0].task_id if f.processing_tasks else None,
|
||||||
'upload_batch': f.upload_batch,
|
'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,
|
'file_size': f.file_size,
|
||||||
'status': f.status,
|
'status': f.status,
|
||||||
'volume': f.volume,
|
'volume': f.volume,
|
||||||
@@ -644,7 +646,7 @@ class StorageIntegrationService:
|
|||||||
'filename': f.original_filename,
|
'filename': f.original_filename,
|
||||||
'latest_id': f.id,
|
'latest_id': f.id,
|
||||||
'latest_task_id': task_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,
|
'latest_status': f.status,
|
||||||
'upload_count': upload_count,
|
'upload_count': upload_count,
|
||||||
'file_size': f.file_size,
|
'file_size': f.file_size,
|
||||||
|
|||||||
+9
-1
@@ -32,7 +32,15 @@ function formatNumber(num) {
|
|||||||
function formatDateTime(dateString) {
|
function formatDateTime(dateString) {
|
||||||
if (!dateString) return "N/A";
|
if (!dateString) return "N/A";
|
||||||
try {
|
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 {
|
} catch {
|
||||||
return dateString;
|
return dateString;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user