修改acList数据的目录

This commit is contained in:
2025-10-29 16:54:18 +08:00
parent 0c78a025f4
commit 7de4fff7cf
5 changed files with 59 additions and 37 deletions

View File

@@ -200,10 +200,13 @@ class JsonUtils:
return updated
@classmethod
def query_all_json_items(cls, filename="log/last_message.json") -> list:
"""
查询 JSON 文件(数组)中的所有项,并剔除 sender 和 text 为空的记录
查询 JSON 文件(数组)中的所有项,并剔除 sender 为空的记录
:param filename: JSON 文件路径
:return: list可能为空
"""
@@ -212,8 +215,8 @@ class JsonUtils:
if not isinstance(data, list):
return []
# 过滤 sender 和 text 为空字符串的项
return [item for item in data if
isinstance(item, dict) and item.get("sender", "").strip() and item.get("text", "").strip()]
return [item for item in data if isinstance(item, dict) and item.get("sender", "").strip() and item.get("text", "").strip()]
@classmethod