优化停止任务逻辑
This commit is contained in:
@@ -243,8 +243,8 @@ def growAccount():
|
||||
thread = threading.Thread(target=manager.growAccount, args=(udid, event))
|
||||
thread.start()
|
||||
# 添加到线程管理
|
||||
ThreadManager.add(udid, thread, event)
|
||||
return ResultData(data="").toJson()
|
||||
code , msg = ThreadManager.add(udid, thread, event)
|
||||
return ResultData(data="", code=code, message= msg).toJson()
|
||||
|
||||
|
||||
# 观看直播
|
||||
@@ -268,7 +268,7 @@ def stopScript():
|
||||
udid = body.get("udid")
|
||||
LogManager.method_info(f"接口收到 /stopScript udid={udid}", method="task")
|
||||
code, msg = ThreadManager.stop(udid)
|
||||
return ResultData(code=code, data="", massage=msg).toJson()
|
||||
return ResultData(code=code, data="", message=msg).toJson()
|
||||
|
||||
|
||||
# 关注打招呼
|
||||
@@ -302,6 +302,7 @@ def passAnchorData():
|
||||
return ResultData(data="").toJson()
|
||||
except Exception as e:
|
||||
LogManager.error(e)
|
||||
return ResultData(data="", code=1001).toJson()
|
||||
|
||||
|
||||
# 获取私信数据
|
||||
@@ -322,7 +323,7 @@ def addTempAnchorData():
|
||||
"""
|
||||
data = request.get_json()
|
||||
if not data:
|
||||
return ResultData(code=400, massage="请求数据为空").toJson()
|
||||
return ResultData(code=400, message="请求数据为空").toJson()
|
||||
# 追加到 JSON 文件
|
||||
AiUtils.save_aclist_flat_append(data, "log/acList.json")
|
||||
return ResultData(data="ok").toJson()
|
||||
@@ -356,7 +357,7 @@ def getChatTextInfo():
|
||||
'text': 'Unable to retrieve chat messages on the current screen. Please navigate to the TikTok chat page and try again!!!'
|
||||
}
|
||||
]
|
||||
return ResultData(data=data, massage="解析失败").toJson()
|
||||
return ResultData(data=data, message="解析失败").toJson()
|
||||
|
||||
|
||||
# 监控消息
|
||||
@@ -383,7 +384,7 @@ def upLoadLogLogs():
|
||||
if ok:
|
||||
return ResultData(data="日志上传成功").toJson()
|
||||
else:
|
||||
return ResultData(data="", massage="日志上传失败").toJson()
|
||||
return ResultData(data="", message="日志上传失败").toJson()
|
||||
|
||||
|
||||
# 获取当前的主播列表数据
|
||||
@@ -450,8 +451,8 @@ def update_last_message():
|
||||
multi=False # 只改第一条匹配的
|
||||
)
|
||||
if updated_count > 0:
|
||||
return ResultData(data=updated_count, massage="修改成功").toJson()
|
||||
return ResultData(data=updated_count, massage="修改失败").toJson()
|
||||
return ResultData(data=updated_count, message="修改成功").toJson()
|
||||
return ResultData(data=updated_count, message="修改失败").toJson()
|
||||
|
||||
|
||||
@app.route("/delete_last_message", methods=['POST'])
|
||||
@@ -467,8 +468,8 @@ def delete_last_message():
|
||||
multi=False # 只改第一条匹配的
|
||||
)
|
||||
if updated_count > 0:
|
||||
return ResultData(data=updated_count, massage="修改成功").toJson()
|
||||
return ResultData(data=updated_count, massage="修改失败").toJson()
|
||||
return ResultData(data=updated_count, message="修改成功").toJson()
|
||||
return ResultData(data=updated_count, message="修改失败").toJson()
|
||||
|
||||
|
||||
# @app.route("/killWda", methods=['POST'])
|
||||
|
||||
@@ -105,7 +105,6 @@ class FlaskSubprocessManager:
|
||||
|
||||
# 守护线程:把子进程 stdout → LogManager.info/system
|
||||
threading.Thread(target=self._flush_stdout, daemon=True).start()
|
||||
|
||||
LogManager.info(f"Flask 子进程已启动,PID={self.process.pid},端口={self.comm_port}", udid="system")
|
||||
|
||||
if not self._wait_port_open(timeout=10):
|
||||
@@ -122,6 +121,8 @@ class FlaskSubprocessManager:
|
||||
for line in iter(self.process.stdout.readline, ""):
|
||||
if line:
|
||||
LogManager.info(line.rstrip(), udid="system")
|
||||
# 同时输出到控制台
|
||||
print(line.rstrip()) # 打印到主进程的控制台
|
||||
self.process.stdout.close()
|
||||
|
||||
# ---------- 发送 ----------
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from Module.DeviceInfo import Deviceinfo
|
||||
from Module.FlaskSubprocessManager import FlaskSubprocessManager
|
||||
from Utils.DevDiskImageDeployer import DevDiskImageDeployer
|
||||
from Utils.LogManager import LogManager
|
||||
|
||||
|
||||
# 确定 exe 或 py 文件所在目录
|
||||
BASE = Path(getattr(sys, 'frozen', False) and sys.executable or __file__).resolve().parent
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user