增加切换账号功能
This commit is contained in:
@@ -151,6 +151,7 @@ def deviceList():
|
||||
LogManager.error("获取设备列表失败:", e)
|
||||
return ResultData(data=[]).toJson()
|
||||
|
||||
|
||||
# 传递token
|
||||
@app.route('/passToken', methods=['POST'])
|
||||
def passToken():
|
||||
@@ -158,6 +159,7 @@ def passToken():
|
||||
print(data)
|
||||
return ResultData(data="").toJson()
|
||||
|
||||
|
||||
# 获取设备应用列表
|
||||
@app.route('/deviceAppList', methods=['POST'])
|
||||
def deviceAppList():
|
||||
@@ -309,6 +311,7 @@ def passAnchorData():
|
||||
LogManager.error(e)
|
||||
return ResultData(data="", code=1001).toJson()
|
||||
|
||||
|
||||
@app.route('/followAndGreetUnion', methods=['POST'])
|
||||
def followAndGreetUnion():
|
||||
try:
|
||||
@@ -401,11 +404,13 @@ def getChatTextInfo():
|
||||
# 监控消息
|
||||
@app.route("/replyMessages", methods=['POST'])
|
||||
def monitorMessages():
|
||||
LogManager.method_info("开始监控消息,监控消息脚本启动", "监控消息")
|
||||
body = request.get_json()
|
||||
udid = body.get("udid")
|
||||
manager = ScriptManager()
|
||||
event = threading.Event()
|
||||
thread = threading.Thread(target=manager.replyMessages, args=(udid, event))
|
||||
LogManager.method_info("创建监控消息脚本线程成功", "监控消息")
|
||||
# 添加到线程管理
|
||||
ThreadManager.add(udid, thread, event)
|
||||
return ResultData(data="").toJson()
|
||||
@@ -444,7 +449,6 @@ def queryAnchorList():
|
||||
|
||||
|
||||
# 修改当前的主播列表数据
|
||||
|
||||
@app.route("/updateAnchorList", methods=['POST'])
|
||||
def updateAnchorList():
|
||||
"""
|
||||
@@ -548,7 +552,7 @@ def update_last_message():
|
||||
updated_count = JsonUtils.update_json_items(
|
||||
match={"sender": sender, "text": text}, # 匹配条件
|
||||
patch={"state": 1}, # 修改内容
|
||||
filename="log/last_message.json", # 要修改的文件
|
||||
filename="last_message.json", # 要修改的文件
|
||||
multi=False # 只改第一条匹配的
|
||||
)
|
||||
if updated_count > 0:
|
||||
@@ -566,7 +570,7 @@ def delete_last_message():
|
||||
|
||||
updated_count = JsonUtils.delete_json_items(
|
||||
match={"sender": sender, "text": text}, # 匹配条件
|
||||
filename="log/last_message.json", # 要修改的文件
|
||||
filename="last_message.json", # 要修改的文件
|
||||
multi=False # 只改第一条匹配的
|
||||
)
|
||||
if updated_count > 0:
|
||||
@@ -582,18 +586,24 @@ def stopAllTask():
|
||||
return ResultData(code, [], msg).toJson()
|
||||
|
||||
|
||||
# @app.route("/killWda", methods=['POST'])
|
||||
# def killWda():
|
||||
# data = request.get_json() # 解析 JSON
|
||||
# udid = data.get("device")
|
||||
# print(udid)
|
||||
#
|
||||
#
|
||||
# AiUtils.kill_wda(udid)
|
||||
# time.sleep(10)
|
||||
# AiUtils.launch_wda(udid)
|
||||
#
|
||||
# return ResultData(data="", msg="WDA重新启动").toJson()
|
||||
# 切换账号
|
||||
@app.route('/changeAccount', methods=['POST'])
|
||||
def changeAccount():
|
||||
body = request.get_json()
|
||||
udid = body.get("udid")
|
||||
account_id = body.get("account_id")
|
||||
|
||||
IOSAIStorage.save(account_id, f"{udid}/accountId.json")
|
||||
|
||||
# 存储到本地
|
||||
manager = ScriptManager()
|
||||
event = threading.Event()
|
||||
|
||||
# 启动脚本
|
||||
thread = threading.Thread(target=manager.changeAccount, args=(udid, event))
|
||||
# 添加到线程管理
|
||||
code, msg = ThreadManager.add(udid, thread, event)
|
||||
return ResultData(data="", code=code, message=msg).toJson()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -36,7 +36,7 @@ def main(arg):
|
||||
if __name__ == "__main__":
|
||||
|
||||
# 获取启动时候传递的参数
|
||||
# main(sys.argv)
|
||||
main(sys.argv)
|
||||
|
||||
# 添加iOS开发包到电脑上
|
||||
deployer = DevDiskImageDeployer(verbose=True)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user