diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index bb25dd2..a2c0f00 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,13 +4,14 @@
-
+
+
+
+
-
-
@@ -61,6 +62,7 @@
"ASKED_ADD_EXTERNAL_FILES": "true",
"ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",
"Python.12.executor": "Run",
+ "Python.123 (1).executor": "Run",
"Python.123.executor": "Run",
"Python.Main.executor": "Run",
"Python.Test.executor": "Run",
@@ -92,11 +94,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -111,7 +137,7 @@
-
+
@@ -143,29 +169,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -237,11 +240,11 @@
+
+
-
-
@@ -318,7 +321,7 @@
-
+
@@ -368,7 +371,15 @@
1758121742405
-
+
+
+ 1758197707496
+
+
+
+ 1758197707496
+
+
@@ -392,7 +403,8 @@
-
+
+
@@ -404,12 +416,12 @@
-
+
-
-
+
+
\ No newline at end of file
diff --git a/Module/FlaskService.py b/Module/FlaskService.py
index 02358ec..6612b22 100644
--- a/Module/FlaskService.py
+++ b/Module/FlaskService.py
@@ -443,7 +443,7 @@ def updateAnchorList():
updated = 0
for item in acList:
if isinstance(item, dict) and item.get("invitationType") == invitationType:
- item["status"] = new_status
+ item["state"] = new_status
updated += 1
# 写回(保持原始结构)
@@ -512,7 +512,7 @@ def update_last_message():
updated_count = JsonUtils.update_json_items(
match={"sender": sender, "text": text}, # 匹配条件
- patch={"status": 1}, # 修改内容
+ patch={"state": 1}, # 修改内容
filename="log/last_message.json", # 要修改的文件
multi=False # 只改第一条匹配的
)
diff --git a/Utils/AiUtils.py b/Utils/AiUtils.py
index 4aeeaf1..28c726a 100644
--- a/Utils/AiUtils.py
+++ b/Utils/AiUtils.py
@@ -708,23 +708,69 @@ class AiUtils(object):
LogManager.info(f"[acList] 已追加 {len(to_add)} 条,当前总数={len(data)} -> {file_path}")
# -------- 弹出(取一个删一个) --------
+ # @classmethod
+ # def pop_aclist_first(cls, filename="log/acList.json"):
+ # """
+ # 从 JSON 数组中取出第一个 anchor 对象,并删除它;为空或文件不存在返回 None。
+ # 返回形如:{"anchorId": "...", "country": "..."}
+ # """
+ # file_path = Path(filename)
+ # data = cls._read_json_list(file_path)
+ # if not data:
+ # return None
+ #
+ # first = data.pop(0)
+ # # 兜底保证结构
+ # norm = cls._normalize_anchor_items(first)
+ # first = norm[0] if norm else None
+ #
+ # cls._write_json_list(file_path, data)
+ # return first
+
@classmethod
- def pop_aclist_first(cls, filename="log/acList.json"):
+ def pop_aclist_first(cls, filename="Module/log/acList.json", mode="pop"):
"""
- 从 JSON 数组中取出第一个 anchor 对象,并删除它;为空或文件不存在返回 None。
- 返回形如:{"anchorId": "...", "country": "..."}
+ 从 JSON 数组/对象(anchorList)中取出第一个 anchor 对象。
+ - mode="pop" : 取出并删除
+ - mode="move" : 取出并放到列表尾部
+ 返回形如:{"anchorId": "...", "country": "...", ...}
"""
- file_path = Path(filename)
- data = cls._read_json_list(file_path)
+ file_path = cls._resolve_path(filename)
+ if not file_path.exists():
+ return None
+
+ try:
+ raw = json.loads(file_path.read_text(encoding="utf-8-sig"))
+ except Exception as e:
+ LogManager.error(f"[pop_aclist_first] 读取失败: {e}")
+ return None
+
+ # 支持两种格式:list 或 dict{anchorList:[...]}
+ if isinstance(raw, list):
+ data, wrapper = raw, None
+ elif isinstance(raw, dict) and isinstance(raw.get("anchorList"), list):
+ data, wrapper = raw["anchorList"], raw
+ else:
+ return None
+
if not data:
return None
+ # 取第一个
first = data.pop(0)
- # 兜底保证结构
norm = cls._normalize_anchor_items(first)
first = norm[0] if norm else None
- cls._write_json_list(file_path, data)
+ if first and mode == "move":
+ # 放到尾部
+ data.append(first)
+
+ # 写回
+ to_write = wrapper if wrapper is not None else data
+ file_path.write_text(
+ json.dumps(to_write, ensure_ascii=False, indent=2),
+ encoding="utf-8"
+ )
return first
@classmethod
diff --git a/script/ScriptManager.py b/script/ScriptManager.py
index 9855034..d457980 100644
--- a/script/ScriptManager.py
+++ b/script/ScriptManager.py
@@ -325,8 +325,18 @@ class ScriptManager():
# 循环条件。1、 循环关闭 2、 数据处理完毕
while not event.is_set():
- # 获取一个主播,并删除
+ # 获取一个主播,
+ result = AiUtils.peek_aclist_first()
+ state = result.get("state",0)
+ if not state:
+ LogManager.method_info(f"当前主播的状态是:{state} 不通行,取出数据移到列表尾部 继续下一个", "关注打招呼", udid)
+ AiUtils.pop_aclist_first(mode="move")
+ continue
+
+ # 并删除
anchor = AiUtils.pop_aclist_first()
+ LogManager.method_info(f"当前主播的状态是:{state} 通行,取出数据删除", "关注打招呼", udid)
+
if not anchor:
LogManager.method_info(f"数据库中的数据不足", "关注打招呼", udid)
time.sleep(30)