2025-10-24 更新评论功能

This commit is contained in:
2025-10-24 19:04:07 +08:00
parent ba4bcff7e1
commit fe8c07d2a6
10 changed files with 69 additions and 19 deletions

6
.idea/git_toolbox_blame.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

3
.idea/iOSAI.iml generated
View File

@@ -4,7 +4,4 @@
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="py.test" />
</component>
</module>

View File

@@ -3,12 +3,18 @@
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="numpy" />
<item index="1" class="java.lang.String" itemvalue="facebook_wda" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="facebook_wda" />
<option value="Flask" />
<option value="flask_cors" />
<option value="Requests" />
<option value="tidevice" />
<option value="N803" />
</list>
</option>
</inspection_tool>

4
.idea/misc.xml generated
View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12" />
<option name="sdkName" value="Python 3.12 (AI-IOS)" />
</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 (AI-IOS)" project-jdk-type="Python SDK" />
</project>

29
.idea/workspace.xml generated
View File

@@ -5,8 +5,16 @@
</component>
<component name="ChangeListManager">
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="20250904-初步功能已完成">
<change afterPath="$PROJECT_DIR$/.idea/git_toolbox_blame.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/insert_comment2.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/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" 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$/Module/DeviceInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/Module/DeviceInfo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Utils/LogManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/Utils/LogManager.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/00008110-000120603C13801E/bgv.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resources/00008110-000120603C13801E/bgv_comment.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/script/ScriptManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/script/ScriptManager.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -36,6 +44,7 @@
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/build.bat" root0="SKIP_INSPECTION" />
<setting file="file://$PROJECT_DIR$/script/ScriptManager.py" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
@@ -69,7 +78,7 @@
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;javascript.nodejs.core.library.configured.version&quot;: &quot;20.17.0&quot;,
&quot;javascript.nodejs.core.library.typings.version&quot;: &quot;20.17.58&quot;,
&quot;last_opened_file_path&quot;: &quot;E:/code/Python/iOSAi/resources/iproxy&quot;,
&quot;last_opened_file_path&quot;: &quot;E:/python/IOSAI/Module/Main.py&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
@@ -77,11 +86,13 @@
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;editing.templates&quot;,
&quot;two.files.diff.last.used.file&quot;: &quot;E:/share/iOSAI/Module/FlaskService.py&quot;,
&quot;two.files.diff.last.used.folder&quot;: &quot;C:/Users/zhangkai/Desktop/last-item/iosai/Utils&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="E:\python\IOSAI\resources" />
<recent name="E:\code\Python\iOSAi\resources\iproxy" />
<recent name="C:\Users\zhangkai\Desktop\last-item\iosai\Utils" />
<recent name="C:\Users\zhangkai\Desktop\20250916ios\iOSAI\resources" />
@@ -107,6 +118,7 @@
<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$/Module/IOSActivator.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
@@ -125,7 +137,7 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="SDK_NAME" value="Python 3.12" />
<option name="SDK_NAME" value="IOSAI" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
@@ -140,6 +152,10 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Python.Main" />
<item itemvalue="Python.IOSActivator" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.IOSActivator" />
@@ -149,7 +165,8 @@
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-python-sdk-ce6832f46686-7b97d883f26b-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-252.25557.178" />
<option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-PY-241.18034.82" />
<option value="bundled-python-sdk-975db3bf15a3-2767605e8bc2-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-241.18034.82" />
</set>
</attachedChunks>
</component>
@@ -217,6 +234,10 @@
<workItem from="1757998910052" duration="3676000" />
<workItem from="1758354349526" duration="2512000" />
<workItem from="1758358259572" duration="8994000" />
<workItem from="1761294846575" duration="176000" />
<workItem from="1761295123036" duration="2130000" />
<workItem from="1761302874416" duration="154000" />
<workItem from="1761303188517" duration="637000" />
</task>
<task id="LOCAL-00001" summary="ai 开始测试">
<option name="closed" value="true" />

View File

@@ -26,7 +26,7 @@ def _force_utf8_everywhere():
except Exception:
pass
# _force_utf8_everywhere()
_force_utf8_everywhere()
class LogManager:
"""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -45,6 +45,7 @@ class ScriptManager():
self.resources_dir = project_root / "resources"
self.comment_dir = self.resources_dir / "comment.png"
self.comment_add_dir = self.resources_dir / "insert_comment.png"
self.comment_add_dir2 = self.resources_dir / "insert_comment2.png"
self.initialized = True # 标记已初始化
@@ -73,25 +74,44 @@ class ScriptManager():
img.save(filePath)
# 从评论列表中随机取出一条数据,进行评论
single_comment = random.choice(Variables.commentList)
if Variables.commentList:
single_comment = random.choice(Variables.commentList)
else:
single_comment = "评论没有导入数据"
coord2 = OCRUtils.find_template(str(self.comment_add_dir), filePath)
# print(single_comment)
if coord2: # 二判命中
print(f"方案1")
cx2, cy2 = coord2[0]
print(f"添加评论:{cx2, cy2}")
session.tap(int(cx2 / 3), int(cy2 / 3))
print(f"点击添加评论的坐标:{int(cx2 / 3)}, {int(cy2 / 3)}")
session.send_keys(f"{single_comment}\n")
# session.send_keys(f"hello\n")
time.sleep(2)
LogManager.method_info("评论成功", "养号", udid)
else:
time.sleep(1)
print(f"方案2")
img = session.screenshot()
filePath = os.path.join(os.path.dirname(filePath), "bgv_comment.png")
img.save(filePath)
coord3 = OCRUtils.find_template(str(self.comment_add_dir2), filePath)
if coord3: # 二判命中
cx3, cy3 = coord3[0]
session.tap(int(cx3 / 3), int(cy3 / 3))
session.send_keys(f"{single_comment}\n")
time.sleep(2)
LogManager.method_info("评论成功", "养号", udid)
# 点返回/取消按钮:优先用推荐按钮坐标,没有就兜底 100,100
tap_x = int(recomend_cx) if recomend_cx else 100
tap_y = int(recomend_cy) if recomend_cy else 100
session.tap(tap_x, tap_y)
time.sleep(1)
session.tap(tap_x, tap_y)
# 养号
def growAccount(self, udid, event, is_monitoring=False):