C7/C8: employees.last_login_ip 列补全(ALTER TABLE 迁移)+ redis decode 兼容修复 7 处(wecom_service×2/employee_directory×3/auth_wecom_sso×2,统一 isinstance 保护模式)

This commit is contained in:
Simon
2026-07-18 10:50:27 +08:00
parent 928f4bb337
commit 05304aec9c
3 changed files with 20 additions and 8 deletions
+9 -3
View File
@@ -62,7 +62,9 @@ async def get_org_directory(
raw = await redis.get(ORG_DIRECTORY_CACHE_KEY)
if raw:
logger.debug("命中组织目录缓存")
return json.loads(raw.decode("utf-8")), True
# v4.0 C8 修复:兼容 str/bytes
raw = raw if isinstance(raw, str) else raw.decode("utf-8")
return json.loads(raw), True
except Exception as e:
logger.warning(f"读取组织目录缓存失败(降级): {e}")
@@ -306,7 +308,9 @@ async def get_cached_dept_list(
try:
raw = await redis.get(DEPT_LIST_CACHE_KEY)
if raw:
return json.loads(raw.decode("utf-8"))
# v4.0 C8 修复:兼容 str/bytes
raw = raw if isinstance(raw, str) else raw.decode("utf-8")
return json.loads(raw)
except Exception as e:
logger.warning(f"读取部门列表缓存失败: {e}")
@@ -607,7 +611,9 @@ async def get_org_tree_cached(
try:
raw = await redis.get(cache_key)
if raw:
tree = json.loads(raw.decode("utf-8"))
# v4.0 C8 修复:兼容 str/bytes
raw = raw if isinstance(raw, str) else raw.decode("utf-8")
tree = json.loads(raw)
logger.debug(f"命中组织架构树缓存: {endpoint}")
except Exception as e:
logger.warning(f"读取组织架构树缓存失败: {e}")