fix: Fix the defect that the knowledge base vectorization time is inconsistent with the system

--bug=1052060 --user=王孝刚 【知识库】-同步Web站点知识库,同步状态的时间与当前时区不一致,晚8小时 https://www.tapd.cn/57709429/s/1651754
This commit is contained in:
wxg0103 2025-02-08 16:00:16 +08:00 committed by wxg
parent bf12d2bfd3
commit 2c03b2859d
2 changed files with 6 additions and 3 deletions

View File

@ -9,6 +9,7 @@
import logging
import os
import threading
import datetime
import traceback
from typing import List
@ -229,9 +230,11 @@ class ListenerManagement:
next_index = taskType.value + 1
current_index = taskType.value
status_number = state.value
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') + '+00'
params_dict = {'${bit_number}': bit_number, '${up_index}': up_index,
'${status_number}': status_number, '${next_index}': next_index,
'${table_name}': query_set.model._meta.db_table, '${current_index}': current_index}
'${table_name}': query_set.model._meta.db_table, '${current_index}': current_index,
'${current_time}': current_time}
for key in params_dict:
_value_ = params_dict[key]
exec_sql = exec_sql.replace(key, str(_value_))

View File

@ -6,8 +6,8 @@ status_meta = jsonb_set (
"${table_name}".status_meta,
'{state_time,${current_index}}',
jsonb_set (
COALESCE ( "${table_name}".status_meta #> '{state_time,${current_index}}', jsonb_build_object ( '${status_number}', now( ) ) ),
COALESCE ( "${table_name}".status_meta #> '{state_time,${current_index}}', jsonb_build_object ( '${status_number}', '${current_time}' ) ),
'{${status_number}}',
CONCAT ( '"', now( ), '"' ) :: JSONB
CONCAT ( '"', '${current_time}', '"' ) :: JSONB
)
)