This commit is contained in:
dataeaseShu
2025-07-24 13:51:22 +08:00
6 changed files with 15 additions and 6 deletions
-1
View File
@@ -63,7 +63,6 @@ class TokenMiddleware(BaseHTTPMiddleware):
with Session(engine) as session:
session_user = await get_user_info(session = session, user_id = token_data.id)
session_user = UserInfoDTO.model_validate(session_user)
session_user = UserInfoDTO.model_validate(session_user)
""" if token_data.oid != session_user.oid:
raise HTTPException(
status_code=401,
+8
View File
@@ -8,6 +8,8 @@ import asyncio
import random
from collections import defaultdict
from apps.system.schemas.auth import CacheName
from apps.system.schemas.system_schema import UserInfoDTO
from common.utils.utils import SQLBotLogUtil
# 使用contextvar来跟踪当前线程已持有的锁
@@ -118,6 +120,9 @@ def cache(
# 双重检查
if (cached := await backend.get(cache_key)) is not None:
SQLBotLogUtil.debug(f"Cache hit: {cache_key}")
if CacheName.USER_INFO.value in cache_key:
user = UserInfoDTO.model_validate(cached)
SQLBotLogUtil.info(f"User cache hit: [uid: {user.id}, account: {user.account}, oid: {user.oid}]")
return cached
# 执行函数并缓存结果
@@ -129,6 +134,9 @@ def cache(
await backend.set(cache_key, result, actual_expire)
SQLBotLogUtil.debug(f"Cache set: {cache_key} (expire: {actual_expire}s)")
if CacheName.USER_INFO.value in cache_key:
user = UserInfoDTO.model_validate(result)
SQLBotLogUtil.info(f"User cache set: [uid: {user.id}, account: {user.account}, oid: {user.oid}]")
return result
return wrapper
+2 -1
View File
@@ -32,6 +32,7 @@
"password_reset_successful": "Password reset successful"
},
"dashboard": {
"length_limit64": "Field length must be between 1 and 64",
"sort_column": "Sort field",
"sort_type": "Sort type",
"time": "Time",
@@ -59,7 +60,7 @@
"name_desc": "Sort by Name (Descending)",
"select_dashboard": "Please Select Dashboard",
"view": "View",
"text": "Text",
"text": "Rich Text",
"preview": "Preview",
"creator": "Creator",
"dashboard_id": "Dashboard ID",
+2 -1
View File
@@ -34,6 +34,7 @@
"password_reset_successful": "重置密码成功"
},
"dashboard": {
"length_limit64": "字段长度需要在1-64之间",
"sort_column": "排序字段",
"sort_type": "排序方式",
"time": "时间",
@@ -62,7 +63,7 @@
"select_dashboard": "请选择仪表板",
"name": "名称",
"view": "图表",
"text": "文本",
"text": "富文本",
"preview": "预览",
"creator": "创建人",
"dashboard_id": "仪表板ID",
@@ -95,7 +95,7 @@ const resourceFormRules = ref({
{
min: 1,
max: 64,
message: 'Chart limit 1-64',
message: t('dashboard.length_limit64'),
trigger: 'change',
},
{ required: true, trigger: 'blur' },
+2 -2
View File
@@ -9,7 +9,7 @@ const props = withDefaults(
type: string
typeName: string
num: string
isSelected: boolean
isSelected?: boolean
description?: string
id?: string
}>(),
@@ -34,7 +34,7 @@ const SelectDs = () => {
</script>
<template>
<div class="card" @click="SelectDs" :class="isSelected && 'is-selected'">
<div class="card" :class="isSelected && 'is-selected'" @click="SelectDs">
<div class="name-icon">
<img :src="icon" width="32px" height="32px" />
<div class="info">