20250904-初步功能已完成
This commit is contained in:
2
.idea/iOSAI.iml
generated
2
.idea/iOSAI.iml
generated
@@ -2,7 +2,7 @@
|
|||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="jdk" jdkName="Python 3.12" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.12 (IOS-AI)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -3,5 +3,5 @@
|
|||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="sdkName" value="Python 3.12" />
|
<option name="sdkName" value="Python 3.12" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (IOS-AI)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
||||||
112
.idea/workspace.xml
generated
112
.idea/workspace.xml
generated
@@ -5,11 +5,18 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="ai 开始测试">
|
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="ai 开始测试">
|
||||||
<change afterPath="$PROJECT_DIR$/resources/iproxy/tidevice.exe" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/resources/0712d741bca636be03668ea6ff53a64141c0151e/bgv.png" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/tidevice_entry.py" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/resources/2335890f77fb51322361bd46b85f7fd1311aed53/bgv.png" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/resources/fc18bc21951daf7be012a8a687b00a4de8b24c18/bgv.png" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/iOSAI.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/iOSAI.iml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Entity/Variables.py" beforeDir="false" afterPath="$PROJECT_DIR$/Entity/Variables.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Entity/Variables.py" beforeDir="false" afterPath="$PROJECT_DIR$/Entity/Variables.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/build.bat" beforeDir="false" afterPath="$PROJECT_DIR$/build.bat" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Module/FlaskService.py" beforeDir="false" afterPath="$PROJECT_DIR$/Module/FlaskService.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Utils/AiUtils.py" beforeDir="false" afterPath="$PROJECT_DIR$/Utils/AiUtils.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Utils/LogManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/Utils/LogManager.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/script/ScriptManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ScriptManager.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/tidevice_entry.py" beforeDir="false" afterPath="$PROJECT_DIR$/tidevice_entry.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -49,34 +56,34 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
"Python.123.executor": "Run",
|
"Python.123.executor": "Run",
|
||||||
"Python.Main.executor": "Run",
|
"Python.Main.executor": "Run",
|
||||||
"Python.tidevice_entry.executor": "Run",
|
"Python.tidevice_entry.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"javascript.nodejs.core.library.configured.version": "22.18.0",
|
"javascript.nodejs.core.library.configured.version": "20.17.0",
|
||||||
"javascript.nodejs.core.library.typings.version": "22.18.0",
|
"javascript.nodejs.core.library.typings.version": "20.17.58",
|
||||||
"last_opened_file_path": "F:/company code/AI item/20250820/iOSAI",
|
"last_opened_file_path": "F:/company code/AI item/20250820/iOSAI",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "com.gitee.ui.GiteeSettingsConfigurable",
|
"settings.editor.selected.configurable": "com.gitee.ui.GiteeSettingsConfigurable",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
<recent name="E:\Code\python\iOSAI\resources" />
|
<recent name="E:\Code\python\iOSAI\resources" />
|
||||||
<recent name="E:\Code\python\iOSAI" />
|
<recent name="E:\Code\python\iOSAI" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager" selected="Python.Main">
|
||||||
<configuration name="Main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
<configuration name="Main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||||
<module name="iOSAI" />
|
<module name="iOSAI" />
|
||||||
<option name="ENV_FILES" value="" />
|
<option name="ENV_FILES" value="" />
|
||||||
@@ -86,7 +93,6 @@
|
|||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
</envs>
|
</envs>
|
||||||
<option name="SDK_HOME" value="" />
|
<option name="SDK_HOME" value="" />
|
||||||
<option name="SDK_NAME" value="Python 3.12" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<option name="IS_MODULE_SDK" value="false" />
|
<option name="IS_MODULE_SDK" value="false" />
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
@@ -101,6 +107,34 @@
|
|||||||
<option name="INPUT_FILE" value="" />
|
<option name="INPUT_FILE" value="" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="tidevice_entry" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="iOSAI" />
|
||||||
|
<option name="ENV_FILES" value="" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tidevice_entry.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Python.tidevice_entry" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
<component name="SharedIndexes">
|
<component name="SharedIndexes">
|
||||||
<attachedChunks>
|
<attachedChunks>
|
||||||
@@ -151,6 +185,10 @@
|
|||||||
<workItem from="1756817404737" duration="95000" />
|
<workItem from="1756817404737" duration="95000" />
|
||||||
<workItem from="1756876974097" duration="8214000" />
|
<workItem from="1756876974097" duration="8214000" />
|
||||||
<workItem from="1756886673655" duration="1733000" />
|
<workItem from="1756886673655" duration="1733000" />
|
||||||
|
<workItem from="1756902713950" duration="1669000" />
|
||||||
|
<workItem from="1756905956255" duration="1709000" />
|
||||||
|
<workItem from="1756962238298" duration="14230000" />
|
||||||
|
<workItem from="1756979981948" duration="4536000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="ai 开始测试">
|
<task id="LOCAL-00001" summary="ai 开始测试">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -169,16 +207,32 @@
|
|||||||
<component name="UnknownFeatures">
|
<component name="UnknownFeatures">
|
||||||
<option featureType="com.intellij.fileTypeFactory" implementationName="*.bat" />
|
<option featureType="com.intellij.fileTypeFactory" implementationName="*.bat" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
<option name="TAB_STATES">
|
||||||
|
<map>
|
||||||
|
<entry key="MAIN">
|
||||||
|
<value>
|
||||||
|
<State />
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||||
<MESSAGE value="ai 开始测试" />
|
<MESSAGE value="ai 开始测试" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="ai 开始测试" />
|
<option name="LAST_COMMIT_MESSAGE" value="ai 开始测试" />
|
||||||
</component>
|
</component>
|
||||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||||
<SUITE FILE_PATH="coverage/iOSAI$Main.coverage" NAME="Main Coverage Results" MODIFIED="1756877405122" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
|
<SUITE FILE_PATH="coverage/iOSAI$LogManager.coverage" NAME="LogManager 覆盖结果" MODIFIED="1756711414832" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Utils" />
|
||||||
<SUITE FILE_PATH="coverage/iOSAI$mac_wda_agent.coverage" NAME="mac_wda_agent Coverage Results" MODIFIED="1756473148639" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/script" />
|
<SUITE FILE_PATH="coverage/iOSAI$123__1_.coverage" NAME="123 (1) 覆盖结果" MODIFIED="1756897091135" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||||
<SUITE FILE_PATH="coverage/iOSAI$tidevice_entry.coverage" NAME="tidevice_entry Coverage Results" MODIFIED="1756886706033" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
<SUITE FILE_PATH="coverage/iOSAI$FlaskService.coverage" NAME="FlaskService 覆盖结果" MODIFIED="1756730187792" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Module" />
|
||||||
<SUITE FILE_PATH="coverage/iOSAI$123.coverage" NAME="123 覆盖结果" MODIFIED="1756300694280" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
|
<SUITE FILE_PATH="coverage/iOSAI$test.coverage" NAME="test 覆盖结果" MODIFIED="1756467664420" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||||
<SUITE FILE_PATH="coverage/iOSAI$windows_run.coverage" NAME="windows_run Coverage Results" MODIFIED="1756473558532" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/script" />
|
<SUITE FILE_PATH="coverage/iOSAI$windows_run.coverage" NAME="windows_run Coverage Results" MODIFIED="1756473558532" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/script" />
|
||||||
|
<SUITE FILE_PATH="coverage/iOSAI$tidevice_entry.coverage" NAME="tidevice_entry 覆盖结果" MODIFIED="1756906458478" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||||
|
<SUITE FILE_PATH="coverage/iOSAI$mac_wda_agent.coverage" NAME="mac_wda_agent Coverage Results" MODIFIED="1756473148639" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/script" />
|
||||||
|
<SUITE FILE_PATH="coverage/iOSAI$ScriptManager.coverage" NAME="ScriptManager 覆盖结果" MODIFIED="1756896057801" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/script" />
|
||||||
|
<SUITE FILE_PATH="coverage/iOSAI$Main.coverage" NAME="Main 覆盖结果" MODIFIED="1756985459457" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
|
||||||
|
<SUITE FILE_PATH="coverage/iOSAI$123.coverage" NAME="123 覆盖结果" MODIFIED="1756712884433" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -16,7 +16,12 @@ commentsList = []
|
|||||||
# 存储主播名和session_id的字典
|
# 存储主播名和session_id的字典
|
||||||
anchorWithSession = {}
|
anchorWithSession = {}
|
||||||
|
|
||||||
|
# 前端传递的token
|
||||||
token = ''
|
token = ''
|
||||||
|
# 前端传递的
|
||||||
|
tenantId = 0
|
||||||
|
|
||||||
|
userId = 0
|
||||||
|
|
||||||
|
|
||||||
# 安全删除数据
|
# 安全删除数据
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from Utils.ControlUtils import ControlUtils
|
|||||||
from Utils.ThreadManager import ThreadManager
|
from Utils.ThreadManager import ThreadManager
|
||||||
from script.ScriptManager import ScriptManager
|
from script.ScriptManager import ScriptManager
|
||||||
from Entity.Variables import anchorList, addModelToAnchorList
|
from Entity.Variables import anchorList, addModelToAnchorList
|
||||||
|
import Entity.Variables
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
@@ -310,19 +311,19 @@ def monitorMessages():
|
|||||||
return ResultData(data="").toJson()
|
return ResultData(data="").toJson()
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/setLoginInfo", methods=['POST'])
|
||||||
@app.route("/upLoadLogFile", methods=['POST'])
|
|
||||||
def upLoadLogFile():
|
def upLoadLogFile():
|
||||||
ok = LogManager.upload_all_logs(
|
data = request.get_json() # 解析 JSON
|
||||||
server_url="http://47.79.98.113:8101/api/log/upload",
|
token = data.get("token")
|
||||||
extra_data={"project": "TikTokAuto", "env": "dev"}
|
userId = data.get("userId")
|
||||||
)
|
tenantId = data.get("tenantId")
|
||||||
|
ok = LogManager.upload_all_logs("http://47.79.98.113:8101/api/log/upload", token, userId, tenantId)
|
||||||
if ok:
|
if ok:
|
||||||
|
print(123)
|
||||||
return ResultData(data="日志上传成功").toJson()
|
return ResultData(data="日志上传成功").toJson()
|
||||||
else:
|
else:
|
||||||
return ResultData(data="", msg="日志上传失败").toJson()
|
return ResultData(data="", msg="日志上传失败").toJson()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run("0.0.0.0", port=5000, debug=True, use_reloader=False)
|
app.run("0.0.0.0", port=5000, debug=True, use_reloader=False)
|
||||||
|
|||||||
@@ -253,16 +253,15 @@ class AiUtils(object):
|
|||||||
# 查找发消息按钮
|
# 查找发消息按钮
|
||||||
@classmethod
|
@classmethod
|
||||||
def getSendMesageButton(cls, session: Client):
|
def getSendMesageButton(cls, session: Client):
|
||||||
# msgButton = session.xpath("//Window[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[1]/Other[2]/Other[2]/Other[1]/Other[1]/Other[3]/Other[1]/Other[1]")
|
|
||||||
|
|
||||||
# msgButton = session.xpath(
|
|
||||||
# '//XCUIElementTypeButton[@name="发消息" or @label="发消息"]')
|
|
||||||
|
|
||||||
msgButton = session.xpath(
|
msgButton = session.xpath(
|
||||||
'//XCUIElementTypeButton['
|
'//XCUIElementTypeButton['
|
||||||
'(@name="发消息" or @label="发消息" or @name="发送 👋" or @label="发送 👋")'
|
'(@name="发消息" or @label="发消息" or '
|
||||||
|
'@name="发送 👋" or @label="发送 👋" or '
|
||||||
|
'@name="消息" or @label="消息")'
|
||||||
' and @visible="true"]'
|
' and @visible="true"]'
|
||||||
)
|
)
|
||||||
|
|
||||||
if msgButton.exists:
|
if msgButton.exists:
|
||||||
print("3.发消息按钮找到了")
|
print("3.发消息按钮找到了")
|
||||||
LogManager.info("3.发消息按钮找到了")
|
LogManager.info("3.发消息按钮找到了")
|
||||||
|
|||||||
@@ -80,18 +80,19 @@
|
|||||||
# shutil.rmtree(item)
|
# shutil.rmtree(item)
|
||||||
#
|
#
|
||||||
# print("日志清空完成")
|
# print("日志清空完成")
|
||||||
|
import datetime
|
||||||
|
import io
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
import zipfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from Entity.Variables import token
|
import Entity.Variables
|
||||||
|
|
||||||
|
|
||||||
class LogManager:
|
class LogManager:
|
||||||
@@ -260,52 +261,45 @@ class LogManager:
|
|||||||
print("日志清空完成")
|
print("日志清空完成")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def upload_all_logs(cls, server_url: str, extra_data: dict = None):
|
def upload_all_logs(cls, server_url, token, userId, tenantId):
|
||||||
"""
|
|
||||||
上传 log/ 目录下所有文件和子目录中的日志
|
|
||||||
"""
|
|
||||||
log_path = Path(cls.logDir)
|
log_path = Path(cls.logDir)
|
||||||
if not log_path.exists():
|
if not log_path.exists():
|
||||||
print("[upload_all_logs] 日志目录不存在")
|
print("[upload_all_logs] 日志目录不存在")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
success_files, failed_files = [], []
|
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
filename = f"{timestamp}_logs.zip"
|
||||||
|
|
||||||
for file in log_path.rglob("*.log"): # 递归找到所有 .log 文件
|
zip_buf = io.BytesIO()
|
||||||
try:
|
with zipfile.ZipFile(zip_buf, "w", compression=zipfile.ZIP_DEFLATED) as zf:
|
||||||
|
for p in log_path.rglob("*"):
|
||||||
|
if p.is_file():
|
||||||
|
arcname = str(p.relative_to(log_path))
|
||||||
|
zf.write(p, arcname=arcname)
|
||||||
|
|
||||||
files = {"file": open(file, "rb")}
|
zip_bytes = zip_buf.getvalue()
|
||||||
headers = {
|
|
||||||
"Authorization": f"Bearer {token}",
|
headers = {"vvtoken": token}
|
||||||
|
data = {"tenantId": tenantId, "userId": userId}
|
||||||
|
|
||||||
|
|
||||||
|
files = {
|
||||||
|
"file": (filename, io.BytesIO(zip_bytes), "application/zip")
|
||||||
}
|
}
|
||||||
|
print(
|
||||||
|
f"[upload_all_logs] "
|
||||||
|
f"server={server_url} (type={type(server_url)}) "
|
||||||
|
f"tenantId={tenantId} (type={type(tenantId)}) "
|
||||||
|
f"userId={userId} (type={type(userId)}) "
|
||||||
|
f"token={token} (type={type(token)})"
|
||||||
|
)
|
||||||
|
|
||||||
data = {
|
print("开始上传")
|
||||||
# "relative_path": str(file.relative_to(log_path))
|
# 3) 上传
|
||||||
"tenantId": 1,
|
resp = requests.post(server_url, headers=headers, data=data, files=files)
|
||||||
"userId": 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
if extra_data:
|
|
||||||
data.update(extra_data)
|
|
||||||
resp = requests.post(server_url, files=files, data=data, headers=headers ,timeout=15)
|
|
||||||
|
|
||||||
print(resp.text)
|
print(resp.text)
|
||||||
print(resp.status_code)
|
print("上传结束")
|
||||||
|
|
||||||
if resp.status_code == 200:
|
if resp.json()['data']:
|
||||||
success_files.append(file.name)
|
return True
|
||||||
else:
|
return False
|
||||||
failed_files.append((file.name, resp.status_code))
|
|
||||||
except Exception as e:
|
|
||||||
failed_files.append((file.name, str(e)))
|
|
||||||
finally:
|
|
||||||
try:
|
|
||||||
files["file"].close()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
print(f"[upload_all_logs] 成功上传: {success_files}")
|
|
||||||
if failed_files:
|
|
||||||
print(f"[upload_all_logs] 失败文件: {failed_files}")
|
|
||||||
|
|
||||||
return len(failed_files) == 0
|
|
||||||
|
|||||||
@@ -417,6 +417,7 @@ class ScriptManager():
|
|||||||
LogManager.method_info("视频看完了,重置试图查询深度", "关注打招呼", udid)
|
LogManager.method_info("视频看完了,重置试图查询深度", "关注打招呼", udid)
|
||||||
session.appium_settings({"snapshotMaxDepth": 25})
|
session.appium_settings({"snapshotMaxDepth": 25})
|
||||||
|
|
||||||
|
time.sleep(0.5)
|
||||||
# 向上滑动
|
# 向上滑动
|
||||||
session.swipe_down()
|
session.swipe_down()
|
||||||
|
|
||||||
@@ -485,18 +486,18 @@ class ScriptManager():
|
|||||||
|
|
||||||
print("即将要回复消息")
|
print("即将要回复消息")
|
||||||
LogManager.method_info("即将要回复消息", "关注打招呼", udid)
|
LogManager.method_info("即将要回复消息", "关注打招呼", udid)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if needReply:
|
if needReply:
|
||||||
print("如果需要回复主播消息。走此逻辑")
|
print("如果需要回复主播消息。走此逻辑")
|
||||||
|
|
||||||
print("----------------------------------------------------------")
|
print("----------------------------------------------------------")
|
||||||
|
|
||||||
# if AiUtils.getUnReadMsgCount(session) > 0:
|
|
||||||
|
|
||||||
print("监控回复消息")
|
print("监控回复消息")
|
||||||
|
|
||||||
# 执行回复消息逻辑
|
# 执行回复消息逻辑
|
||||||
self.monitorMessages(session, udid)
|
self.monitorMessages(session, udid)
|
||||||
|
|
||||||
|
|
||||||
homeButton = AiUtils.findHomeButton(udid)
|
homeButton = AiUtils.findHomeButton(udid)
|
||||||
if homeButton.exists:
|
if homeButton.exists:
|
||||||
homeButton.click()
|
homeButton.click()
|
||||||
@@ -508,19 +509,13 @@ class ScriptManager():
|
|||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
print("重新创建wda会话 防止wda会话失效")
|
print("重新创建wda会话 防止wda会话失效")
|
||||||
|
|
||||||
client = wda.USBClient(udid)
|
client = wda.USBClient(udid)
|
||||||
session = client.session()
|
session = client.session()
|
||||||
|
|
||||||
# 执行完成之后。继续点击搜索
|
# 执行完成之后。继续点击搜索
|
||||||
session.appium_settings({"snapshotMaxDepth": 15})
|
session.appium_settings({"snapshotMaxDepth": 15})
|
||||||
# 点击搜索按钮
|
|
||||||
# ControlUtils.clickSearch(session)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
session.appium_settings({"snapshotMaxDepth": 15})
|
session.appium_settings({"snapshotMaxDepth": 15})
|
||||||
# 点击搜索按钮
|
|
||||||
# ControlUtils.clickSearch(session)
|
|
||||||
print("greetNewFollowers方法执行完毕")
|
print("greetNewFollowers方法执行完毕")
|
||||||
|
|
||||||
# 检测消息
|
# 检测消息
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# tidevice_entry.py
|
|
||||||
from tidevice.__main__ import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
Reference in New Issue
Block a user