查询优化
This commit is contained in:
parent
48b2c373ca
commit
c1cdcacfa2
|
@ -77,7 +77,6 @@ class AsyncTaskDataQuery:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
results = Bd_task_db.query_database(sql_query)
|
results = Bd_task_db.query_database(sql_query)
|
||||||
|
|
||||||
if not results:
|
if not results:
|
||||||
print(f"警告: 未找到batch_id {self.batch_id} 的记录")
|
print(f"警告: 未找到batch_id {self.batch_id} 的记录")
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -87,18 +87,18 @@ def get_task_details(request):
|
||||||
# 准备响应数据
|
# 准备响应数据
|
||||||
response_data = {
|
response_data = {
|
||||||
"code": 200,
|
"code": 200,
|
||||||
"message": "成功",
|
"message": "查询成功",
|
||||||
"time": current_time,
|
"check_time": current_time,
|
||||||
"task_id": task_id,
|
"task_id": task_id,
|
||||||
"task_logs": task_logs,
|
|
||||||
"batch_id": result.get("batch_id", ""),
|
"batch_id": result.get("batch_id", ""),
|
||||||
"create_status": result.get("create_status", ""),
|
"total_logs": len(task_logs),
|
||||||
"total_logs": len(task_logs)
|
"task_logs": task_logs,
|
||||||
|
"create_status": result.get("create_status", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
# 如果是浏览器请求,返回HTML视图
|
# 如果是浏览器请求,返回HTML视图
|
||||||
if is_browser_request:
|
if is_browser_request:
|
||||||
logger.info(response_data)
|
logger.info(json.dumps(response_data))
|
||||||
return render(request, 'json_formatter3.html', {
|
return render(request, 'json_formatter3.html', {
|
||||||
# "json_data": response_data,
|
# "json_data": response_data,
|
||||||
"json_data": json.dumps(response_data, ensure_ascii=False, indent=2),
|
"json_data": json.dumps(response_data, ensure_ascii=False, indent=2),
|
||||||
|
|
|
@ -106,11 +106,11 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
TIME_ZONE = 'Asia/Shanghai'
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = False
|
||||||
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
|
Loading…
Reference in New Issue